Pagini recente » Cod sursa (job #707786) | Cod sursa (job #903737) | Cod sursa (job #2878882) | Cod sursa (job #550408) | Cod sursa (job #413193)
Cod sursa(job #413193)
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
const char in[]="restante.in", out[]="restante.out";
struct cuv{ char c[20];bool x;}v[36050];
struct cmp{
bool operator()(const char &a, const char &b)
{
return a<b;
}
};
struct cmp1{
bool operator()(const cuv &a, const cuv &b)
{
return strcmp(a.c, b.c) > 0 ? 0 : 1;
}
};
int main()
{
freopen(in,"r",stdin);
freopen(out,"w",stdout);
int n;
char aux[20];
scanf("%d\n", &n);
int s = n;
for(int i = 0; i < n; ++i)
{
scanf("%s\n", aux);
sort(aux, aux + strlen(aux), cmp());
strcpy(v[i].c, aux);
}
sort(v, v+n, cmp1());
for(int i = 0; i < n; ++i)
{if(!strcmp(v[i].c, v[i+1].c))v[i].x=1, v[i+1].x=1;
if(v[i].x)--s;}
printf("%d\n", s);
return 0;
}