Cod sursa(job #943885)

Utilizator Stefex09Stefan Teodorescu Stefex09 Data 26 aprilie 2013 18:41:37
Problema Restante Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.8 kb
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>

using namespace std;

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

typedef pair <string, string> PSS;

PSS S[36010];

inline bool comp (const PSS &A, const PSS &B)
{
    return A.first < B.first;
}

int main()
{
    int N, i, j, Ans = 0, now = 1;

    in >> N;
    for (i = 1; i <= N; i ++){
        in >> S[i].first;
        S[i].second = S[i].first;
        sort (S[i].first.begin (), S[i].first.end ());
    }

    sort (S + 1, S + N + 1, comp);

    for (i = 1; i <= N; i ++){
        if (S[i].first == S[i + 1].first)
            now ++;
        else{
            if (now == 1)
                Ans ++;

            now = 1;
        }
    }

    out << Ans;

    return 0;
}