#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector <int> vi;
typedef vector <vi> vii;
typedef pair<int,int> pii;
typedef int ft;
#define get getchar_unlocked
#define put putchar_unlocked
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define ln length()
#define rep(i,n) for(int i=0;i<n;i++)
#define ref(i,a,n) for(int i=a;i<=n;i++)
#define reb(i,n,a) for(int i=n;i>=a;i--)
#define all(a) a.begin(),a.end()
#define gi(n) scanf("%d",&n)
#define gii(n) scanf("%lld",&n)
#define gc(c) scanf(" %c",&c)
#define pi(n) printf("%d",n)
#define pii(n) printf("%lld",n)
#define pc(c) printf("%c",c)
#define ps printf(" ")
#define pn printf("\n")
int gl(char *str) { char c; int i=0; while(!(scanf("%c",&c)==EOF || c=='\n')) str[i++]=c;str[i++]=' ';str[i]='\0'; return i;}
void pl(char *str) { rep(i,strlen(str)) put(str[i]); }
void gfi(ft &x) {
register ft c = get(); x = 0; ft sn=1;
for(;(c<48 || c>57);c = get()) if(c=='-') sn=-1;
for(;c>47 && c<58;c = get()) {x = (x<<1) + (x<<3) + c - 48;}
x*=sn;
}
char str[10000000];
int main() {
int t,n,flag=1,f;
gfi(t);
gl(str);
while(strlen(str)==1) {
gl(str);
}
while(t--) {
// scanf("%s",str);
if(flag) flag=0; else gl(str);
n=strlen(str);
// cout << str << " " << strlen(str) << endl;
int ans=0,temp=0,prev=-1,curr=0,cnt=0;
rep(i,n) {
// cout << "cur: " << curr << " " << "pre: " << prev << endl;
if(str[i]!=' ') temp++; else {
f=1;
// cout << temp << endl;
if(temp)
curr=temp;
else f=0;
if(curr==prev) {if(f) cnt++;} else cnt=0;
ans=max(ans,cnt);
temp=0;
if(curr)
prev=curr;
}
// cout << "cnt: " << cnt << endl;
}
if(strlen(str)==1) cout << "0" << endl;
else cout << ans+1 << endl;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdHlwZWR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