Cod sursa(job #1782343)

Utilizator depevladVlad Dumitru-Popescu depevlad Data 17 octombrie 2016 23:45:59
Problema Restante Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.75 kb
#include <cstdio>
#include <vector>
#include <cstring>
#include <algorithm>

using namespace std;

const int kMaxN = 36005;
const int kLength = 20;

int n;
char b[kLength];
vector <int> c[kMaxN];

int main() {
    freopen("restante.in", "r", stdin);
    freopen("restante.out", "w", stdout);
    
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        c[i] = vector <int>(26, 0);
        gets(b);
        for (int j = 0; j < strlen(b); j++) 
            c[i][b[i] - 'a']++;
    }
    
    sort(c + 1, c + n + 1);
    
    int goodCount = 0;
    for (int i = 1; i <= n; i++) {
        if (c[i] != c[i - 1] && c[i] != c[i + 1]) {
            goodCount++;
        }
    }
    
    printf("%d\n", goodCount);
    return 0;
}