传送门
板子题就不写题解了。
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const ull mod=212370440130137957ll;
const ull base=131,pre=233317;
const int N=1e4+7;
ull a[N];
ull get_hash(string a)
{
ull res=0;
for(int i=0;i<(int )a.length();i++){
res=(res*base+1ull*a[i])%mod+pre;
}
return res;
}
signed main()
{
int n; scanf("%d",&n);
for(int i=1;i<=n;i++){
string tmp; cin>>tmp;
a[i]=get_hash(tmp);
}
sort(a+1,a+1+n);
int res=1;
for(int i=2;i<=n;i++) if(a[i]!=a[i-1]) res++;
printf("%d\n",res);
}