Pagini recente » 123456789 | Cod sursa (job #2904934) | Cod sursa (job #1775999) | Cod sursa (job #656386) | Cod sursa (job #239354)
Cod sursa(job #239354)
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include <stdlib.h>
using namespace std;
int n,O[1000001];
char c[36001][20];
int comp(int a,int b){
return strcmp( c[a], c[b] )<0;
}
void citire()
{
scanf("%d ",&n);
for(int i=0;i<n;i++)
{
fgets(c[i],20,stdin);
int N=strlen(c[i])-1;
if(c[i][N]=='\n')
{c[i][N]='\0';
N--;
}
sort(c[i],c[i]+N+1);
}
}
void solve()
{
for (int i=0; i<=n; ++i)
O[i] = i;
sort(O, O+n, comp);
int nr=0;
for(int i=0;i<n-1;i++)
{int nrr=0;
while(strcmp(c[O[i]],c[O[i+1]])==0)
{i++;nrr++;}
if(nrr==0)
nr++;
}
printf("%d\n",nr);
}
int main()
{
freopen("restante.in","r",stdin);
freopen("restante.out","w",stdout);
citire();
solve();
return 0;
}