can someone help me understand wht my code shows wrong answer even though i cleared the test case
import java.util.;
import java.lang.;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner s=new Scanner(System.in);
int t=s.nextInt();
s.nextLine();
while(t–!=0)
{
String A=s.nextLine();
String B=s.nextLine();
int count=0,flag=0;
if(A.equals(B))
{
System.out.println(count);
}
else
{
for(int i=0;i<A.length();i+=2)
{
char a=A.charAt(i);
char b=B.charAt(i);
if(a==b)
continue;
else
{
flag=1;
if(a==‘1’)
{
A=A.substring(0,i)+‘0’+A.substring(i+1);
}
else
{
A=A.substring(0,i)+‘1’+A.substring(i+1);
}
}
}
if(flag==1)
count++;
flag=0;
for(int i=1;i<A.length();i+=2)
{
char a=A.charAt(i);
char b=B.charAt(i);
if(a==b)
continue;
else
{
flag=1;
if(a==‘1’)
{
A=A.substring(0,i)+‘0’+A.substring(i+1);
}
else
{
A=A.substring(0,i)+‘1’+A.substring(i+1);
}
}
}
if(flag==1)
count++;
flag=0;
if(A.equals(B))
System.out.println(count);
}
}
}
}