problem
solution
统计各个字符数,只要都是n的倍数就可以了
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int num[250];
int main(){
int T; cin>>T;
while(T--){
int n; cin>>n;
memset(num,0,sizeof(num));
for(int i = 1; i <= n; i++){
string s; cin>>s;
for(int i = 0; i < s.size(); i++)
num[s[i]-'A']++;
}
int ok = 1;
for(int i = 0; i <= 100; i++){
if(num[i]%n!=0){
ok = 0; break;
}
}
if(ok)cout<<"YES\n";
else cout<<"NO\n";
}
return 0;
}