atcoder#ARC155A. [ARC155A] ST and TS Palindrome
[ARC155A] ST and TS Palindrome
Score : points
Problem Statement
You are given a string of length consisting of lowercase English letters, and a positive integer .
Determine whether there is a string of length that satisfies the following conditions.
- The concatenation of and in this order is a palindrome.
- The concatenation of and in this order is a palindrome.
You have test cases to solve.
Constraints
- is a string of length consisting of lowercase English letters.
- All numbers in the input are integers.
- In each input file, the sum of over the test cases is at most .
Input
The input is given from Standard Input in the following format:
Each case is in the following format:
Output
Print lines. The -th line should contain Yes
if there is a string that satisfies the conditions for the -th test case, and No
otherwise.
2
6 2
abbaab
5 3
abcbb
Yes
No
For the first test case, if we let ba
, for instance, the concatenation of and in this order will be abbaabba
, which is a palindrome. Here, the concatenation of and in this order is baabbaab
, which is also a palindrome. Thus, ba
satisfies the condition, so the answer is Yes
.
For the second test case, we can prove that no string satisfies the conditions.
3
12 400378271514996652
njvhhvjnnjvh
10 884633988115575508
rrhiyvrrur
36 71630165869626180
vsxmxajrrduhhudrrjaxmxsvvsxmxajrrduh
Yes
No
Yes