Problem: Example

Input

2 1
WE


Output

1 2

Solution (in CPP):

Solution:
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> P;

const ll INF = 1e15;
const double eps = 1e-6;
const ll MOD = 1000000007;
/*
class Node {
public:
	vector<P> frontier;
	Node* use;
	Node* unuse;
	Node(vector<P> fr) : frontier(fr) {}
	bool operator < (const Node &n) const {
		return frontier < n.frontier;
	}
};

ll solve(int n) {
	vector<Node> nodes;
	map<Node, int> node_num;

}

int main() {
	int n;
	cin >> n;
	cout << n << "x" << n << " := " << solve(n) << " 通り" << endl;
	return 0;
}
*/

int main() {
	ll n, m;
	cin >> n >> m;
	vector<string> area(m);
	for (int i = 0;i < m;i++)
		cin >> area[i];
	vector<int> cnt(n);
	for (int i = 0;i < m;i++)
		for (int j = 0;j < n;j++)
			if (area[i][j] == 'W')
				cnt[j]++;
			else
				cnt[j]--;
	vector<int> imos(n + 2);
	for (int i = 0;i < n;i++)
		imos[i + 1] = imos[i] + cnt[i];
	P ans = P(-1, -1);
	for (int i = 0;i <= n;i++)
		ans = max(ans, P(imos[i], -i));
	cout << -ans.second << " " << -ans.second + 1 << endl;
	return 0;
}