Cod sursa(job #2094101)

Utilizator arcoC. Nicolae arco Data 25 decembrie 2017 01:59:49
Problema Restante Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.85 kb
#include <iostream>
#include <algorithm>
#include <map>
#include <fstream>

using namespace std;

int main(void)
{
    ifstream inp("restante.in");
    ofstream out("restante.out");

    if(inp.is_open() && out.is_open())
    {
        map<string, int> hashtable;
        int n;
        inp >> n;
        for(int i = 0; i < n; i++)
        {
            string t;
            inp >> t;
            sort(t.begin(), t.end());

            hashtable[t]++;
        }
        map<string, int>::iterator it;
        int count = 0;
        for(it = hashtable.begin(); it != hashtable.end(); it++)
        {
            if(it->second == 1)
            {
                count++;
            }
        }
        out << count;

        inp.close();
        out.close();
    }
    else
    {
        cout << "error\n";
    }

  return 0;
}