Pagini recente » Cod sursa (job #235858) | Cod sursa (job #927516) | Cod sursa (job #1212274) | Cod sursa (job #2668424) | Cod sursa (job #413176)
Cod sursa(job #413176)
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
const char in[]="restante.in", out[]="restante.out";
struct cuv{ char c[18];bool x;}v[36005];
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[18];
scanf("%d\n", &n);
int s = n;
for(int i=0;i<n;++i)
{memset(aux, 0, sizeof(aux));
scanf("%s", 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;
}