Cod sursa(job #2559373)

Utilizator vvvlll50Lazar Vlad vvvlll50 Data 27 februarie 2020 11:42:39
Problema Restante Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("restante.in");
ofstream g("restante.out");
int n,ap[20][101],val,maxi,maxv,ct;
char s[20];
int main()
{f>>n;
 for(int i=1;i<=n;i++)
 {f>>s;val=0;
  int l=strlen(s);
  for(int j=0;j<l;j++)val|=(1<<(s[j]-'a'));
  ap[l][val]++;
  maxi=max(maxi,l);
  maxv=max(maxv,val);
  //cout<<val<<" ";
 }
 for(int i=1;i<=maxi;i++)
    for(int j=1;j<=maxv;j++)if(ap[i][j]==1)ct++;
 g<<ct<<'\n';
    return 0;
}