need help, for which test case it will not work?
import java.util.*;
class Test{
public static void main (String args[]) {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
in.nextLine();
for(int tc =0 ;tc<t;tc++){
int ans =0 ;
String s = in.nextLine();
int nn= s.length();
int one=0;
int zero =0 ;
//creating new string by squeezing original string, if s = 100010011110 the solo = 101010
String solo = "";
for(int i=1 ;i<nn;i++){
if(s.charAt(i)=='1' && s.charAt(i-1)=='0')
solo+=1 ;
if(s.charAt(i)=='0' && s.charAt(i-1)=='1') solo+=0 ;
}
solo = s.charAt(0)+solo ;
//counting number of zeros and ones
int n = solo.length();
for(int i=0 ;i<n;i++)
if(solo.charAt(i)=='1')
one++;
zero = n - one ;
ans = Math.min(one - 1 ,zero -1);
System.out.println(Math.max(0,ans));
}
}
}