Cod sursa(job #3281532)

Utilizator mihiboiBacis Mihai-Cristian mihiboi Data 2 martie 2025 09:29:28
Problema Restante Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <bits/stdc++.h>
using namespace std;

ifstream fin("restante.in");
ofstream fout("restante.out");

unordered_map <string, int> m;
int n, cnt = 0;
char s[36001][17];
string t;

int main() {
    fin >> n;
    for(int i = 1; i <= n; ++i) {
        fin >> s[i];
        t = s[i];
        sort(t.begin(), t.end());
        m[t]++;
    }
    
    for(int i = 1; i <= n; ++i) {
        t = s[i];
        sort(t.begin(), t.end());
        if(m[t] == 1) {
            cnt++;
        }
    }

    fout << cnt;
    return 0;
}