-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodechef_CHEFING.cpp
More file actions
47 lines (44 loc) · 811 Bytes
/
codechef_CHEFING.cpp
File metadata and controls
47 lines (44 loc) · 811 Bytes
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
#include <bits/stdc++.h>
using namespace std;
#define SIS std::ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define gelo return 0
#define khela_shuru int main()
#define ll long long
const int Max_Char=26;
void xxx(string s[],int n){
bool x[Max_Char];
memset(x,true,sizeof(x));
for(int i=0;i<n;i++){
bool y[Max_Char]={false};
for(int j=0;s[i][j];j++){
if(x[s[i][j]-'a']) y[s[i][j]-'a']=true;
}
memcpy(x ,y , Max_Char);
}
string ss;
for(int i=0;i<26;i++){
if(x[i]) ss+=(i+'a');
}
cout << ss.size() << "\n";
}
void solve()
{
int n,i;
cin >> n;
string s[n];
for(i=0;i<n;i++){
cin >> s[i];
}
xxx(s,n);
}
khela_shuru
{
SIS;
int t;
cin >> t;
while(t--)
{
solve();
}
gelo;
}