WORDCNT - Word Counting
Tác giả: ll931110
Ngôn ngữ: Pascal
Program WORDCNT;
Const
input = '';
output = '';
Var
s: string;
i,t,n: integer;
fi,fo: text;
Procedure init;
Begin
Readln(fi, s);
n:= length(s);
End;
Procedure solve;
Var
max,i,clen,cword,len: integer;
Begin
max:= 0;
clen:= -1;
cword:= 1;
len:= 0;
For i:= 1 to n do
If s[i] <> ' ' then inc(len) else
Begin
If len = clen then inc(cword) else
Begin
If max < cword then max:= cword;
If len <> 0 then
Begin
clen:= len;
cword:= 1;
End;
End;
len:= 0;
End;
If len = clen then inc(cword);
If (max < cword) and (clen <> 0) then max:= cword;
Writeln(fo, max);
End;
Begin
Assign(fi, input);
Reset(fi);
Assign(fo, output);
Rewrite(fo);
Readln(fi, t);
For i:= 1 to t do
Begin
init;
solve;
End;
Close(fo);
Close(fi);
End.