Cod sursa(job #126973)

Utilizator stef2nStefan Istrate stef2n Data 23 ianuarie 2008 00:16:32
Problema Restante Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.72 kb
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

#define NMAX 36005

int N;
vector <string> s;


int main()
{
    freopen("restante.in", "r", stdin);
    freopen("restante.out", "w", stdout);
    scanf("%d", &N);
    for(int i=0; i<N; ++i)
    {
        char tmp1[20];
        scanf("%s", tmp1);
        string tmp2(tmp1);
        sort(tmp2.begin(), tmp2.end());
        s.push_back(tmp2);
    }
    sort(s.begin(), s.end());
    int cnt=0;
    for(int i=0; i<(int)s.size(); ++i)
    {
        bool ok=true;
        if(i>0 && s[i]==s[i-1])
            ok=false;
        if(i<(int)s.size()-1 && s[i]==s[i+1])
            ok=false;
        cnt+=ok;
    }
    printf("%d\n", cnt);
    return 0;
}