#include<stdio.h>
int main()
{
char a[60][60],b[60][60],i=0,n1,m1,n2,m2;
int x,y;
int j=0;
char c;
int p=-1,q=-1,f=-1,g=-1;
scanf("%d%d",&n1,&m1);
for(i=1;i<=n1;i++)
scanf(" %s",a[i]);
scanf("%d%d",&n2,&m2);
for(i=1;i<=n2;i++)
scanf(" %s",b[i]);
for(i=1;i<=n1;i++)
{
for(j=1;j<=m1;j++)
{
if(a[i][j]=='1')
{
p=i;
q=j;
break;
}
}
if(p>0 || q>0)
break;
}
for(i=1;i<=n2;i++)
{
for(j=1;j<=m2;j++)
{
if(b[i][j]=='1')
{
f=i;
g=j;
break;
}
}
if(g!=-1 || f!=-1)
break;
}
printf("%d %d\n",f-p,g-q);
return 0;
}
this is a code snippet. it is not taking i/p in scanf(%s) lines in the code. it is exiting after taking 2 strings only. but not for n1 and n2. please tell ehat is problem ?