Under construction

Still being built. Things may change

Volleyball Match

Interview

Time limit1sMemory limit1024 MB

Summary
Given the winner of each rally, simulate a best-of-3 volleyball match with win-by-2 set rules and print the number of sets each team won.
Level

Easy2 of 10

Topics
Simulation, Implementation
Solved
No attempts yet

Problem

You have been hired by PO-Volley (Påhittade Organisationen för Volleyboll) to keep track of the score in a volleyball match between two teams, Algoritmikerna and Bäverbusarna.

The match is best of 33 sets. The team that first wins 22 sets wins the match. The first two sets are played to 2525 points, and if a third set is needed, it is played to 1515 points. A team must win by 22 points. So the winner of a set is the first team to reach at least 2525 (or 1515 in the third set) points while leading the opponent by at least 22 points. Given which team wins each rally, print the result of the match.

Input

The first line contains an integer NN (1≤N≤2001 \le N \le 200). The next line contains a string of NN characters, each either 'A' or 'B'. The iith character is 'A' if Algoritmikerna wins the iith rally, and 'B' if Bäverbusarna wins it.

Output

Print one line with two integers. The first integer is the number of sets won by Algoritmikerna, and the second integer is the number of sets won by Bäverbusarna.

Hints

In the first sample, team A wins the first set 25−025-0, team B wins the second set 0−250-25, and team A wins the deciding third set 15−015-0. The result is 2−12-1.

In the second sample, team B wins both the first and second sets 25−2725-27, so the result is 0−20-2.

Note that only the first sample could appear in test group 11.

Examples2

  1. Example 1

    Input
    65
    AAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBAAAAAAAAAAAAAAA
    
    Expected output
    2 1
    
  2. Example 2

    Input
    104
    BABABABABABABABABABABABABABABABABABABABABABABABABABBBABABABABABABABABABABABABABABABABABABABABABABABABABB
    
    Expected output
    0 2