Problem: Example

Input

2 1
WE


Output

1 2

Solution (in CPP):

Solution:
#include <iostream>

using namespace std;

int main(){
  int M, N;
  cin >> N >> M;
  string S[M];
  for(int i = 0; i < M; i++){
    cin >> S[i];
  }
  int ct = 0, ans = 1e9, ans_i = 0;
  for(int i = 0; i < M; i++){
    for(int j = 0; j < N; j++){
      if(S[i][j] == 'W') ct++;
    }
  }
  for(int j = 0; j < N + 1; j++){
    if(ct < ans){
      ans = ct;
      ans_i = j;
    }
    if(j == N) break;
    for(int i = 0; i < M; i++){
      if(S[i][j] == 'E') ct++;
      else ct--;
    }
  }
  cout << ans_i << ' ' << ans_i + 1 << endl;

  return 0;
}