Cod sursa(job #1811382)

Utilizator SaitamaSaitama-san Saitama Data 21 noiembrie 2016 10:23:38
Problema Restante Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <bits/stdc++.h>

using namespace std;

map <string, int> M;

int main()
{
    ifstream fin("restante.in");
    ofstream fout("restante.out");
    int N, i, ans;
    fin >> N;
    string x;
    ans = 0;
    for(i = 1; i <= N; i++)
    {
        fin >> x;
        sort(x.begin(), x.end());
        if(!M[x])
        {
            ans++;
            M[x]++;
        }
        else
        {
            if(M[x] == 1)
                ans--;
            M[x]++;
        }
    }
    fout << ans;
    fin.close();fout.close();
    return 0;
}