Problem: Example

Input

2 1
WE


Output

1 2

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(int i=0;i<(int)n;i++)


int main(){
  int n,m;
  cin>>n>>m;
  vector<int> v(n,0);
  lp(i,m){
    string s;
    cin>>s;
    lp(j,n){
      if(s[j]=='W'){
        v[j]--;
      }
      else{
        v[j]++;
      }
    }
  }
  int sum=0,mini=0,ans=-1;
  lp(i,n){
    sum+=v[i];
    if(mini>sum){
      mini=sum;
      ans=i;
    }
  }
  cout<<ans+1<<" "<<ans+2<<endl;
}