# 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
{
int c,n,r=0,i,j,j1,k,k1,t=0,l;
String f= “”,b="",a="";
int a1[]=new int[100];
for(i=0;i<n;i++)
{
c=0;
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);
}
}
}

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

``````        c=0;
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);
}
}
}``````
//