Problem: Example

Input

2 1
WE


Output

1 2

Solution (in CPP):

Solution:
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main(){
	int n, m;
	cin >> n >> m;
	string s;
	char t[100][10000];
	int i, j; int now=0;
	for (i = 0; i < m; i++) {
		cin >> s;
		for (j = 0; j < n; j++) {
			t[i][j] = s[j];
			if (s[j] == 'W')now++;
		}
	}
	int wes[10000];
	for (i = 0; i < n; i++) {
		int sum = 0;
		for (j = 0; j < m; j++) {
			if (t[j][i] == 'W')sum++;
		}
		wes[i] = 2*sum-m;
	}
	int ma = now;
	int check=0;
	for (i = 0; i < n; i++) {
		now += wes[i];
		if (now > ma) {
			ma = now; check = i + 1;
		}
	}
	cout << check << " " << check + 1 << endl;
	return 0;
}