Cod sursa(job #1022572)

Utilizator Athena99Anghel Anca Athena99 Data 5 noiembrie 2013 18:51:31
Problema Restante Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.56 kb
#include <algorithm>
#include <fstream>
#include <cstring>

using namespace std;

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

const int nmax= 36000;

string s[nmax+1];

int main(  ) {
    int n;
    fin>>n;
    for ( int i= 0; i<n; ++i ) {
        fin>>s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s, s+n);

    int sol= 0, p= 0;
    for ( int i= 0; i<n; i=p ) {
        p= i+1;
        while ( s[i]==s[p] ) {
            ++p;
        }
        if ( p==i+1 ) {
            ++sol;
        }
    }

    fout<<sol<<"\n";

    return 0;
}