Cod sursa(job #3143291)

Utilizator SSKMFSS KMF SSKMF Data 28 iulie 2023 19:42:25
Problema Restante Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <fstream>
#include <algorithm>
#include <string>
using namespace std;

ifstream cin ("restante.in");
ofstream cout ("restante.out");

string optiuni[36001];

int main ()
{
    int lungime;
    cin >> lungime;

    for (int indice = 0 ; indice < lungime ; indice++)
        { cin >> optiuni[indice]; sort(optiuni[indice].begin() , optiuni[indice].end()); }

    sort(optiuni , optiuni + lungime);

    int unic = 0;
    for (int indice = 0 ; indice < lungime ; indice++)
        if (optiuni[indice] != optiuni[indice + 1]) unic++;
        else while (optiuni[indice] == optiuni[indice + 1])
            indice++;

    cout << unic;
    cout.close(); cin.close();
    return 0;
}