https://ac.nowcoder.com/acm/problem/214850
#include <iostream>
#include <vector>
using namespace std;
bool check(vector<unsigned int>& vs) {
int left = 0, right = vs.size() - 1;
while (left < right) {
if (!(vs[left] & vs[right])) return false;
++left;
--right;
}
return true;
}
int main() {
int n;
cin >> n;
while (n--) {
int m;
cin >> m;
vector<unsigned int> vs(m, 0); // 使用整数存储字符集合
for (int i = 0; i < m; ++i) {
string s;
cin >> s;
for (auto& c : s) {
vs[i] |= (1 << (c - 'a')); // 将字符转换为整数,并进行位运算
}
}
if (check(vs))
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
}