Start

2021-04-27 14:30 CEST

CNG Prov Prog1

End

2021-04-27 17:00 CEST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -1066 days 7:12:20

Time elapsed

2:30:00

Time remaining

0:00:00

Problem F
The Volleyball Game

You have been hired as a consultant by PO-Volley (the Pathetic Organization for Volleyball) to keep track of the score in a game between the two teams the Algorithmics and the Beaver Boys.

Volleyball is played in best of three sets, i.e. the team that first wins two sets wins the game. The first two sets are played until 25 points. If a third set needs to be played, it is played until 15 points. You also have to win with 2 points, so it is the team that first gets more than 25 (or 15 points in the third set) and also have at least 2 more points than the opponents that wins the set. Given a list of what team won every ball, print the result of the game.

Input

The first line contains an integer $N$ ($1 \le N \le 200$). The next line contains a string with $N$ characters “A” and “B”, where the $i$’th letter is “A” if the Algorithmics won the $i$’th ball and “B” if the Beaver Boys won the $i$’th ball.

Output

Print a line containing two integers. The first integer should be the number of sets the Algorithmics won, and the second the number of sets that the Beaver Boys won.

Scoring

Your solution will be tested on a number of test groups. To get the points for a test group, your solution needs to pass all the test cases in the group.

Group

Points

Limits

1

42

All sets are won on exactly $25$, $25$ and $15$ points respectively, i.e. the score will never be $24$-$24$ in the first two sets or $14$-$14$ in the last set.

2

58

No further constraints.

Explanation of sample

In the forst sample, team A wins the first set with $25-0$, team B the second set with $0-25$ and team A the deciding set with $15-0$. The result of the match is thus $2-1$ in sets.

Team B won both the first and second set with $25-27$, and the result of the game is $0-2$

Note that only sample 1 can appear in the test group 1.

Sample Input 1 Sample Output 1
65
AAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAA
2 1
Sample Input 2 Sample Output 2
104
BABABABABABABABABABABABABABABABABABABABABABABABABABBBABABABABABABABABABABABABABABABABABABABABABABABABABB
0 2