-
Notifications
You must be signed in to change notification settings - Fork 0
/
B.cpp
49 lines (45 loc) · 874 Bytes
/
B.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
#include <cstdio>
#include <queue>
#include <cstring>
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int tc,N,M;
int check[100001][26];
void solve(){
memset(check,0,sizeof(check));
string s,ret;
for(int i=0;i<N;i++){
cin >> s;
for(int j=0;j<M;j++){
check[j][s[j]-'a']++;
}
}
for(int i=0;i<N-1;i++){
cin >> s;
for(int j=0;j<M;j++){
check[j][s[j]-'a']--;
}
}
for(int i=0;i<M;i++){
for(int j=0;j<26;j++){
if(check[i][j]>0){
ret.push_back(j+'a');
}
}
}
cout << ret << '\n';
cout << flush;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> tc;
while(tc--){
cin >> N >> M;
solve();
}
}