Sample Input
2 # number of test cases
AAABBB
ABABABAA
Sample output
Test 1
A 15 0 0
B 0 0 0
A 30 0 0
B 0 0 0
A 40 0 0
B 0 0 0
A 40 0 0
B 15 0 0
A 40 0 0
B 30 0 0
A 40 0 0
B 40 0 0
Test 2
A 15 0 0
B 0 0 0
A 15 0 0
B 15 0 0
A 30 0 0
B 15 0 0
A 30 0 0
B 30 0 0
A 40 0 0
B 30 0 0
A 40 0 0
B 40 0 0
A Adv 0 0
B 0 0
A 0 1 0
B 0 0 0