Cod sursa(job #3371752)

Utilizator bucurmihneaBucur Mihnea David bucurmihnea Data 31 octombrie 2026 14:09:24
Problema Restante Scor 50
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.66 kb
#include <fstream>
#include <cstring>
#include <algorithm>
using namespace std;
ifstream fin("restante.in");
ofstream fout("restante.out");
int main()
{
    int n, nr = 0;
    fin >> n;
    char s[36001][17];
    for(int i = 0; i < n; i++){
        fin >> s[i];
        sort(s[i], s[i] + strlen(s[i]));
    }
    for(int i = 0; i < n - 1; i++)
        for(int j = i + 1; j < n; j++)
            if(strcmp(s[i], s[j]) > 0)
                swap(s[i], s[j]);
    for(int i = 0; i < n; i++)
        if((i == 0 || strcmp(s[i], s[i - 1]) != 0) &&
           (i == n - 1 || strcmp(s[i], s[i + 1]) != 0))
            nr++;
    fout << nr;

    return 0;
}