#Lutece0925. Sequential game
Sequential game
Migrated from Lutece 925 Sequential game
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
Sequential detector is a very important device in Hardware experiments. But is very difficult for many students such as HeroWei
. In nearest days, his teacher Miss Fang let him simulate sequence detector. But there many sequence here ,and Miss Fang add the difficulty that when she give HeroWei
a sequence and a string ,you must tell her how many string here in this sequence. But now Miss Fang simplified the problem for HeroWei
, she just give Herowei
a sequence and let HeroWei
play a game with it.
When comes a character , it must compare with the rightmost one of sequence, if it's the same with the coming characters ,the coming one just join the string. Most the right side. Otherwise all the characters in the sequence must change its value, to and to ,then the coming one add to its right side. Here is an example, if there is a sequence 110
when comes a character ,the sequence become 1100
at last, if comes a character ,the sequence become 0011
at last.
It's very difficult for HeroWei
to play the game. Can you help him?
Input
Each line contains a composed by a string of s and s. the input is ended by EOF
.
Output
For each given sequence you just play with this string as descripted above.Output a line contains two integers ,which are the number of s and s in the sequence after the game.
Samples
0
110
1111
1010
1 0
3 0
0 4
4 0
Note
For example ,1010: 1->00->111->0000
Resources
2011 Heilongjiang collegiate programming contest