Cod sursa(job #3258865)

Utilizator xSLive3DMaries Sergiu xSLive3D Data 23 noiembrie 2024 21:17:02
Problema Restante Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <fstream>
#include <algorithm>
#include <cstring>
#include <unordered_map>

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

std::unordered_map<std::string, int> mp;

int main()
{
    int n;
    int cate = 0;
    fin >> n;
    
    for (int i = 0; i < n; i++)
    {
        std::string word;
        fin >> word;
        std::sort(word.begin(), word.end());
        auto total = mp[word]++;
        if (total == 0)
            cate++;
        else if (total == 1)
            cate--;
    }

    fout << cate;

    return 0;
}