Result: Accepted
Time: 405ms
Memory: 1756kB
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <set>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <deque>
#define clr(a,b) memset(a,b,sizeof(a))
#define ll long long
using namespace std;
const int maxn=1e2+10;
int t,n;
string s[maxn];
int after;
int main()
{
cin>>t;
while(t--)
{
cin>>n;
getchar();
for(int i=0;i<n;i++)cin>>s[i];
after=0;
int maxi=0;
for(int i=0;i<n;i++)
{
after=0;
for(int j=i;j<n;j++)
{
if(s[i]==s[j])after++;
maxi=max(maxi,after);
}
}
printf("%d\n",maxi);
}
}