For which set of numbers is my program giving WRONG ANSWER? Please reply

My program is given as follows:
import java.io.*;
class lstmax
{
public static void main(String args[])throws IOException
{
InputStreamReader read=new InputStreamReader(System.in);
BufferedReader in= new BufferedReader(read);
int c,n,r=0,i,j,j1,k,k1,t=0,l;
String f= “”,b="",a="";
int a1[]=new int[100];
n=Integer.parseInt(in.readLine())
for(i=0;i<n;i++)
{
c=0;
a=(in.readLine());
a=a+" “;
t=0;k=0;
for(j=0;j<a.length();j++)
{
if(a.charAt(j)!=’ ')
f=f+a.charAt(j);
else
{
a1[c++]=Integer.parseInt(f);
f=”";
}
}
int max=a1[0];
for(j=0;j<c;j++)
{
if(a1[j]!=(c-1) && max<a1[j])
max=a1[j];
if(a1[j]==(c-1))
k++;
}
if(k>1 && (c-1)>max)
System.out.println(c-1);
else
System.out.println(max);
}
}
}

please format your program properly

import java.io.*;
class lstmax
{
public static void main(String args[])throws IOException
{
InputStreamReader read=new InputStreamReader(System.in);
BufferedReader in= new BufferedReader(read);
int c,n,r=0,i,j,j1,k,k1,t=0,l;
String f= “”,b="",a="";
int a1[]=new int[100];
n=Integer.parseInt(in.readLine());
for(i=0;i<n;i++)
{

        c=0;
        a=(in.readLine());
        a=a+" ";
        t=0;k=0;
            for(j=0;j<a.length();j++)
            { 
            if(a.charAt(j)!=' ')
            f=f+a.charAt(j);
            else
               {
                a1[c++]=Integer.parseInt(f);
                f="";
                }
            }
        int max=a1[0];
        for(j=0;j<c;j++)
            {
            if(a1[j]!=(c-1) && max<a1[j])
            max=a1[j];
            if(a1[j]==(c-1))
            k++;
            }
        if(k>1 && (c-1)>max)
        System.out.println(c-1);
        else
        System.out.println(max);
    }
    }
}