Problem H

Black and White

 

Macaw Prince had N cards each one either Black or White. He first arranges his card in a line. Then he removes a non-empty subsequence of cards from the line of the cards. The subsequence may not be consecutive; however, there should be at least one Black and at least one White card in the subsequence. And also there should not be any Black Card after a White Card in the subsequence.

 

For example the card sequence is: BWBBW. Then Prince can remove the subsequence (3, 4, 5) [1-indexed]. Because the subsequence is: BBW. There is at least one Black, at least one White, and no Black after a White. Another example: BWBWBW then one valid subsequence can be: (1, 3, 6).

 

Prince wants to remove all the cards from line. However, he has to follow the constraints of valid subsequence to be removed. He is seeking your help. Help him to solve it in minimum number of subsequence removal, that is- perform the subsequence removal operation minimum number of times to remove all the cards from the line.

 

Input

 

First line of the input contains a positive integer T (T <= 50), number of test cases. Hence follows T non empty lines. Each line contains a string consisting of two characters only, B or W. The length of the string can be at most 10,000. Here B denotes Black and W denotes White.

 

Output

 

For each case first output N, here N is the required minimum number of operations. Hence follows N lines. Each line should describe an operation. Each line starts with a positive integer X, hence follows X increasingly sorted space separated integers denoting the index (1-based index) of the cards to be removed from the line. Note that, after an operation index of any card does not change. If it is not possible then print: IMPOSSIBLE instead of printing N. There may be multiple solutions; you may output any valid solution.

 

 

Sample Input

Output for Sample Input

2

BWBW

BWW

 

 

2

2 1 2

2 3 4

1

3 1 2 3

 

 

 

Problemsetter: Md. Mahbubul Hasan

Special Thanks: Shiplu Hawlader