-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathChef got Recipes.cpp
57 lines (54 loc) · 1.21 KB
/
Chef got Recipes.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define rep1(i,n) for(ll i = 1;i <= (n); ++i)
#define pb push_back
#define M 1000000007
unordered_map<ll,ll>mp;
int main()
{
fastIO
ll t;
cin>>t;
while(t--)
{
ll n;string str;
int f[32];
for(int i=0;i<32;i++)
f[i]=0;
cin>>n;
for(ll i=1;i<=n;i++)
{
cin>>str;
int mask=0;
for(char ch: str)
{
if(ch=='a')
mask=mask | (1<<0);
if(ch=='e')
mask=mask |(1<<1);
if(ch=='i')
mask=mask |(1<<2);
if(ch=='o')
mask=mask |(1<<3);
if(ch=='u')
mask=mask |(1<<4);
}
f[mask]++;
}
ll res=0;
for(int i=1;i<32;i++)
{
for(int j=i+1;j<32;j++)
{
if((i|j)==31)
res=res+f[i]*f[j];
}
}
res=res+(f[31]*(f[31]-1))/2;
cout<<res<<"\n";
}
return 0;
}