WORDCNT - Word Counting
Tác giả: hieult
Ngôn ngữ: Java
import java.io.*;
//import java.util.*;
public class Main {
public static void main(String args[]) throws IOException
{
InputStreamReader readin = new InputStreamReader(System.in);
BufferedReader read = new BufferedReader(readin);
String s;
String [] temp;
int n;
s = read.readLine();
n = Integer.parseInt(s);
for(int ii = 1;ii<=n;ii++)
{
s = read.readLine();
temp = s.split(" ");
int t = 1, max = 1 , a=0;
a = temp[0].trim().length();
for(int i = 1;i<temp.length;i++)
{
if(temp[i].trim().length()==0) continue;
else if(a==0)
{
t = 1;
a =temp[i].trim().length();
}
else if(temp[i].trim().length()==a)
t++;
else
{
t = 1;
a =temp[i].trim().length();
}
if(t>max)
max = t;
}
System.out.println(max);
}
}
}