Problem L
I Could Have Won
“We will be closing in about 5 minutes. Thank you for visiting the ICPC gym today.”
With this announcement, Alice and Bob stopped playing their
rock-paper-scissors marathon in the middle of the
After carefully inspecting how each game was played, however, Alice realized that she could have won more games than Bob if they played under slightly different rules, such as first-to-5 or first-to-8, instead of the regular first-to-11.
Given the sequence of points scored by Alice and Bob,
determine all values of
Both Alice and Bob start with zero points at the beginning
of a game. As soon as one player reaches
Input
The single line of input consists of a string of uppercase
letters “A” or “B”, denoting who scored each point from the
beginning of the rock-paper-scissors marathon. The length of
the string is between
Output
On the first line, output the number of positive integers
Sample Input 1 | Sample Output 1 |
---|---|
BBAAABABBAAABB |
3 3 6 7 |
Sample Input 2 | Sample Output 2 |
---|---|
AABBBAAB |
2 2 4 |