Cod sursa(job #979360)

Utilizator DaNutZ2UuUUBB Bora Dan DaNutZ2UuU Data 1 august 2013 12:59:42
Problema Restante Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.81 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;
}