Cod sursa(job #1254523)

Utilizator costty94Duica Costinel costty94 Data 2 noiembrie 2014 20:50:54
Problema Restante Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <stdio.h>
#include <string.h>
#include <algorithm>


using namespace std;

char s[40000][20];
int i, n, r, j, k, a[40000];

int cmp(int x, int y)
{
	return strcmp(s[x], s[y]) < 0;
}


int main()
{
	freopen("restante.in", "r", stdin);
	freopen("restante.out", "w", stdout);

	scanf("%d", &n);
	for(i = 0; i < n; i++)
	{
		scanf("%s", s[i]);
		r = strlen(s[i]);
		sort(s[i], s[i] + r);
		a[i] = i;
	}
	sort(a, a + n, cmp);
	
	for(i = 0; i < n; i++)
	{
		if(strcmp(s[a[i-1]], s[a[i]]) != 0 && strcmp(s[a[i]], s[a[i+1]]) != 0)
			k++;
	}
	printf("%d", k);
		
	return 0;
}