Problem: Example

Input

2 1
WE


Output

1 2

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,m; cin >> n >> m;
    vector<string> d(m);
    for (int i=0;i<m;++i) cin >> d[i];
    int sum=0;
    for (int i=0;i<m;++i)
        for (int j=0;j<n;++j)
            sum+=(d[i][j]=='W');
    int ans=0,Min=sum;
    for (int j=0;j<n;++j){
        for (int i=0;i<m;++i)
            sum+=(d[i][j]=='E'?1:-1);
        if (sum<Min) Min=sum,ans=j+1;
    }
    cout << ans << ' ' << ans+1 << '\n';
}