Cod sursa(job #3371755)
| Utilizator | Data | 31 octombrie 2026 14:16:54 | |
|---|---|---|---|
| Problema | Restante | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.65 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("restante.in");
ofstream fout("restante.out");
int n, w[36001], ind;
long long rez;
char s[36001][17];
bool comp(int a, int b) {
return strcmp(s[a], s[b]) < 0;
}
int main() {
fin >> n;
for(int i = 0; i < n; i++) {
fin >> s[i];
sort(s[i], s[i] + strlen(s[i]));
w[i] = i;
}
sort(w, w + n, comp);
for(int i = 0; i < n;) {
int j = i;
while(j < n && strcmp(s[w[j]], s[w[i]]) == 0)
j++;
if(j - i == 1)
rez++;
i = j;
}
fout << rez;
return 0;
}