2014 Canadian Computing Competition, Stage 1

Problem J2: Vote Count

A vote is held after singer A and singer B compete in the final round of a singing competition.

Your job is to count the votes and determine the outcome.

Input

The input will be two lines. The first line will contain V (1 ≤ V ≤ 15), the total number of votes. The second line of input will be a sequence of V characters, each of which will be A or B, representing the votes for a particular singer.

Output

The output will be one of three possibilites:

  • A, if there are more A votes than B votes;
  • B, if there are more B votes than A votes;
  • Tie, if there are an equal number of A votes and B votes.

Sample Input 1

6
ABBABB

Sample Output 1

B

Sample Input 2

6
ABBABA

Sample Output 2

Tie

All Submissions
Best Solutions


Point Value: 3
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 27, 2014

Languages Allowed:
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3

Comments (Search)

I am using std::string to count the occurrences of A and B from input.
Am I missing something?

Thanks.

Rejudged; AC. In the future I suggest trying cin.ignore(255, '\n') when your code fails completely and you have no clue why. If changing it to this works, then please leave a comment letting us know that the newlines are mangled for that problem.

Thanks, and apologies for the inconvenience.

Thanks again.
Sure, will let you know of such cases.