P10905 [Lanqiao Cup 2024 NOI Qualifier C] Palindrome String

Description

Xiao Lan has recently become interested in palindrome strings. He has a string $S$ that contains only lowercase letters. Xiao Lan may add any number of the specified characters `l`, `q`, `b` (their ASCII codes are $108$, $113$, and $98$, respectively) to the beginning of the string $S$. Xiao Lan wants to know whether he can turn the string $S$ into a palindrome string in this way.

Input Format

The first line of the input contains an integer $T$, meaning that each input contains $T$ test cases. Next, $T$ test cases are described in order. Each test case consists of one line containing a string $S$.

Output Format

Output $T$ lines. Each line contains a string representing the answer for the corresponding test case. If $S$ can be turned into a palindrome string, output `Yes`; otherwise, output `No`.

Explanation/Hint

**[Sample Explanation]** For `gmgqlq`, you can add `qlq` in front => `qlqgmgqlq` to turn it into a palindrome string. For `pdlbll`, it cannot be turned into a palindrome string. For `aaa`, it is already a palindrome string. **[Constraints]** For $50\%$ of the test cases, $1 \le |S| \le 1000$, where $|S|$ denotes the length of the string $S$. For all test cases, $1 \le T \le 10$, $1 \le \sum |S| \le 10^6$. Translated by ChatGPT 5