Result: Accepted
Time: 120ms
Memory: 2940kB
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdio>
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const int maxn=1e3+100;
char a[maxn][maxn];
int main(){
int t;
scanf("%d",&t);
while(t--){
int n,kk=1;
scanf("%d",&n);
getchar();
for(int i=0;i<n;i++) scanf("%s",a[i]);
for(int k=0;k<n;k++){
int kf=1;
for(int i=0;i<n;i++) {
if(k==i) continue;
if(strcmp(a[k],a[i])==0) kf++;
}
kk=max(kf,kk);
}
printf("%d\n",kk);
}
}