Răspuns :
#include <iostream>
#include <cstring>
using namespace std;
int main(){
int n,i,j,ncuvprop=0;
char cuv[100001];
//Citeste n,primul cuvant
cin >> n;
cin >> cuv;
//Determina numarul de aparitii a fiecarei litera
int p[26];
for(i=0;i<26;i++)p[i]=0;
for(i=0;i<strlen(cuv);i++){
if(cuv[i]>='a' && cuv[i]<='z')p[cuv[i]-'a']++;
}
int x[26];//Vector frecventa
//Pentru fiecare cuvant
for(j=1;j<=n;j++){
//Curatare vector frecventa
for(i=0;i<26;i++)x[i]=0;
//Citeste cuvantul
cin >> cuv;
//Determina numarul de aparitii litere
for(i=0;i<strlen(cuv);i++){
if(cuv[i]>='a' && cuv[i]<='z') x[cuv[i]-'a']++;
}
//Verifica daca frecventa literelor e aceasi
bool ok=1;
for(i=0;i<26;i++){
if(x[i]!=p[i])ok=0;
}
//Incrementeaza numarul de cuvinte gasite daca e cazul
if(ok)ncuvprop++;
}
cout << ncuvprop;
}