#P10905. [蓝桥杯 2024 省 C] 回文字符串
[蓝桥杯 2024 省 C] 回文字符串
Problem Description
Xiao Lan has recently become interested in palindrome strings. He has a string that contains only lowercase letters. Xiao Lan may add any number of the specified characters l, q, b (their ASCII codes are , , and , respectively) to the beginning of the string . Xiao Lan wants to know whether he can turn the string into a palindrome string in this way.
Input Format
The first line of the input contains an integer , meaning that each input contains test cases.
Next, test cases are described in order.
Each test case consists of one line containing a string .
Output Format
Output lines. Each line contains a string representing the answer for the corresponding test case. If can be turned into a palindrome string, output Yes; otherwise, output No.
3
gmgqlq
pdlbll
aaa
Yes
No
Yes
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 of the test cases, , where denotes the length of the string .
For all test cases, , .
Translated by ChatGPT 5