Pagini recente » Cod sursa (job #2602008) | Cod sursa (job #1022304) | Cod sursa (job #1860816) | Cod sursa (job #1485900) | Cod sursa (job #413228)
Cod sursa(job #413228)
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
const char in[]="restante.in", out[]="restante.out";
struct cuv{ char c[17];bool x;}v[36000];
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[17];
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;
}