#P1594C. Make Them Equal
Make Them Equal
No submission language available for this problem.
Description
Theofanis has a string and a character . He wants to make all characters of the string equal to using the minimum number of operations.
In one operation he can choose a number () and for every position , where is not divisible by , replace with .
Find the minimum number of operations required to make all the characters equal to and the -s that he should use in his operations.
The first line contains a single integer () — the number of test cases.
The first line of each test case contains the integer () and a lowercase Latin letter — the length of the string and the character the resulting string should consist of.
The second line of each test case contains a string of lowercase Latin letters — the initial string.
It is guaranteed that the sum of over all test cases does not exceed .
For each test case, firstly print one integer — the minimum number of operations required to make all the characters equal to .
Next, print integers () — the -s that should be used in the order they are given.
It can be proved that under given constraints, an answer always exists. If there are multiple answers, print any.
Input
The first line contains a single integer () — the number of test cases.
The first line of each test case contains the integer () and a lowercase Latin letter — the length of the string and the character the resulting string should consist of.
The second line of each test case contains a string of lowercase Latin letters — the initial string.
It is guaranteed that the sum of over all test cases does not exceed .
Output
For each test case, firstly print one integer — the minimum number of operations required to make all the characters equal to .
Next, print integers () — the -s that should be used in the order they are given.
It can be proved that under given constraints, an answer always exists. If there are multiple answers, print any.
Samples
Note
Let's describe what happens in the third test case:
- : we choose all positions that are not divisible by and replace them, i. e. bzyx bzbx;
- : we choose all positions that are not divisible by and replace them, i. e. bzbx bbbb.