Problem: Example

Input

2 1
WE


Output

1 2

Solution (in CPP):

Solution:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
using namespace std;
typedef long long ll;


int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m; cin >> n >> m;
	vector<pair<int,int>> cnt(n+1);
	for(int i=0;i<n+1;i++){
		cnt[i].second=-i;
	}
	while(m--){
		string s; cin >> s;
		int now=0;
		for(int i=1;i<=n;i++){
			if(s[i-1]=='W')now++;
			else now--;
			cnt[i].first+=now;
		}
	}
	sort(cnt.rbegin(),cnt.rend());
	cout << -cnt[0].second << " " << -cnt[0].second+1 << endl;
}