Problem: Example

Input

2 1
WE


Output

1 2

Solution (in CPP):

Solution:
#include <cstdio>
using namespace std;
int H, W; char s[109][10009];
int main() {
	scanf("%d%d", &W, &H);
	for (int i = 0; i < H; i++) scanf("%s", s[i]);
	int lcnt = 0, rcnt = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (s[i][j] == 'W') rcnt++;
		}
	}
	int ret = 0, sum = 999999999;
	for (int i = 0; i <= W; i++) {
		if (sum > lcnt + rcnt) sum = lcnt + rcnt, ret = i;
		if (i == W) continue;
		for (int j = 0; j < H; j++) {
			if (s[j][i] == 'E') lcnt++;
			if (s[j][i] == 'W') rcnt--;
		}
	}
	printf("%d %d\n", ret, ret + 1);
	return 0;
}