将目前讨论区的所有 hack 数据都过掉了。
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
bool ok = 1;
int l = 0, r = (int)s.size() - 1;
while (l <= r) {
if (s[l] == s[r]) l++, r--;
else if (s[r] == 'l' || s[r] == 'q' || s[r] == 'b') r--;
else {
ok = 0;
break;
}
}
cout << (ok ? "Yes\n" : "No\n");
}
}