Problem: Example

Input

2 1
WE


Output

1 2

Solution (in CPP):

Solution:
#include<bits/stdc++.h>
#define H 101
#define W 10001
using namespace std;
int w,h;
string mp[H];

vector<int> count(char ch){
  vector<int> res(w);
  for(int i=0;i<w;i++){
    if(i) res[i]+=res[i-1];
    for(int j=0;j<h;j++)res[i]+=mp[j][i]==ch;

  }
  return res;
}


int main(){
  cin>>w>>h;
  for(int i=0;i<h;i++) cin>>mp[i];
  for(int i=0;i<h;i++) mp[i]='#'+mp[i]+'#';
  w+=2;
  vector<int> west=count('W'),east=count('E');
  
  int mn=1e9,ans=0;
  for(int i=0;i<w;i++){
    int cntW = west.back()-west[i];
    int cntE = east[i];
    int sum = cntW+cntE;
    if(sum<mn)mn=sum,ans=i;
  }
  cout<<ans<<" "<<ans+1<<endl;
  return 0;
}