Wrong Answer
foo.cc: In function 'int main()': foo.cc:23:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result] for(int j=1; j<=m; j++)scanf("%c",&a[i][j]); ~~~~~^~~~~~~~~~~~~~~