https://codeforces.ml/contest/1546/problem/B
题意:
Meaning:
共有2n-1个字符串,你给它补上一个,就有2n个了,这2n个字符串每个位置中,每个字母数量为偶数,那么很简单,遍历每个位置,看这个位置哪个字母数量为奇数即可。
There are a total of 2N-1 strings. If you add one to them, there will be 2n strings. In each position of the 2n strings, the number of letters is even. So it’s very simple to traverse each position to see which letter number is odd.
Code:
#include<bits/stdc++.h>
using namespace std;
int t, n, m;
int main()
{
cin >> t;
while(t --)
{
cin >> n >> m;
vector<string> s(2 * n - 1);
string res = "";
for(int i = 0; i < 2 * n - 1; i ++) cin >> s[i];
for(int i = 0; i < m; i ++)
{
vector cnt(26, 0);
for(int j = 0; j < 2 * n - 1; j ++) cnt[s[j][i] - 'a'] ++;
for(int j = 0; j < 26; j ++) if(cnt[j] & 1) res += 'a' + j;
}
cout << res << endl;
}
}