Problem: Example

Input

2 1
WE


Output

1 2

Solution (in CPP):

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

int main(){
  char c;
  int n,m,s[10002]={};
  cin>>n>>m;
  for(int i=0;i<m;i++)
    for(int j=1;j<=n;j++){
      cin>>c;
      if(c=='W')s[j]++;
    }

  int ans,min=2000000;
  for(int i=1;i<=n;i++)
    s[i]+=s[i-1];
  for(int i=0;i<=n;i++){
    int t=m*i-s[i]+s[n]-s[i];
    if(t<min)min=t,ans=i;
  }
  cout<<ans<<" "<<ans+1<<endl;
  return 0;
}