Pagini recente » Cod sursa (job #2710155) | Cod sursa (job #2540994) | Cod sursa (job #2744470) | Cod sursa (job #725704) | Cod sursa (job #276975)
Cod sursa(job #276975)
#include<stdio.h>
#include<algorithm>
#include<string.h>
#define MAXN 40000
using namespace std;
char s[MAXN][18];
int i,j,n,m;
int ind[MAXN];
bool cmp(const int &b,const int &a)
{
if( strcmp(s[a],s[b])<0)
return true;
return false;
}
int main(void)
{
freopen("restante.in","r",stdin);
freopen("restante.out","w",stdout);
scanf("%d\n",&n);
for(i=1;i<=n;i++)
{
scanf("%s",s[i]);
m=strlen(s[i]);
sort(s[i],s[i]+m);
ind[i]=i;
}
sort(ind+1,ind+n+1,cmp);
int nr=0;
for (i=2;i<n;i++)
if (strcmp(s[ind[i]], s[ind[i-1]]) && strcmp(s[ind[i]], s[ind[i+1]]))
nr++;
if (strcmp(s[ind[1]], s[ind[2]])) nr++;
if (strcmp(s[ind[n-1]], s[ind[n]])) nr++;
printf("%d\n",nr);
return 0;
}