시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB12711311089.431%

문제

Do you follow tennis? If so, you will be aware of the strange scoring system, 15, 30, 40, game. Then, of course there is 40-40 or deuce, with one player having to get 2 points ahead to win a game.

This problem asks you to work out the score of a tennis match given the player who wins each point. To keep things simple, players are called A and B. The points are given as a sequence of letters, where A means a point won by player A, B a point won by player B. Here is an example:

ABAABBAABABAABABBB

Remember, to win a game a player needs to score 4 points, but also to be 2 points ahead. So in the above example, the first game is represented by ABAABBAA and player A has won it. It went to deuce then player A won two points. The second game was represented by BABAABABBB. This game was won by player B. Again it went to deuce, player A went ahead by 1 but player B caught up. Player B then won the last 2 points. After all that, the score would be 1 game all. 

입력

Input will consist of a number of strings of characters, each on a line of its own. No line will contain more than 250 characters. The last line will contain just the # character – this line should not be processed.

Each line represents part of a tennis match, a number of completed games. The line will contain only the upper case letters A and B representing points won by each player. Consider each line as separate, and work out the score, in games, after the points shown. 

출력

Output will be one line for each input line in the form of a score, A x B y where x is the number of games won by A, y is the number of games won by B. 

예제 입력 1

ABAABBAABABAABABBB
AABAABABAAAABBAAABABBAB
#

예제 출력 1

A 1 B 1
A 3 B 1