CCC '14 J2 - Vote Count

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 256M

Problem type
Canadian Computing Competition: 2014 Stage 1, Junior #2

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 Specification

The input will be two lines. The first line will contain V (1 \le V \le 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 Specification

The output will be one of three possibilities:

  • 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

Output for Sample Input 1

B

Sample Input 2

6
ABBABA

Output for Sample Input 2

Tie

Comments


  • 0
    781159  commented on Oct. 14, 2024, 8:35 p.m.

    done in 8 mins w/ comments! lets go!!


  • 0
    amei  commented on Aug. 19, 2024, 6:05 p.m.

    im 8 and need help


    • 1
      htoshiro  commented on Aug. 20, 2024, 1:26 a.m.

      hi 8 and need help I'm dad


  • 10
    Airy  commented on Nov. 25, 2022, 2:27 p.m.

    lol... "Name error" kept existing and I spend HALF AN HOUR finding the problem till I realized instead of "print" I wrote a "pirnt"...


  • 0
    EeveeCS  commented on Sept. 23, 2022, 9:34 p.m.

    Can someone help me? even a small hint would be very helpful.


    • 0
      _wcipeg  commented on Sept. 24, 2022, 12:19 a.m. edit 2

      Your code is more complex than it needs to be. Try using only the count function, and no lists. Also, for help, please join the dmoj discord server instead of asking for help in the comments.


      • 0
        John  commented on Sept. 26, 2022, 6:14 p.m.

        Then what's the point of the comments?


        • 4
          _wcipeg  commented on Sept. 26, 2022, 8:15 p.m.

          For comments


          • 0
            John  commented on Sept. 27, 2022, 4:48 p.m.

            Comments about what?


            • 22
              Viv_CCGS  commented on Sept. 28, 2022, 9:04 a.m.

              Comments about using the discord server instead of asking for help in the comments.


  • 5
    QooModa  commented on Feb. 22, 2022, 3:24 a.m. edited

    Is the V input used only for the iteration?

    At first I thought it would be used to build the sequence of characters, but then in the end, I realized it wasn't.


    • 5
      dizmac  commented on Feb. 22, 2022, 1:39 p.m.

      Yes, it is there to tell you how many characters there will be, as stated by the problem.

      For example, if you are to ignore it, you will need 2 for-loops to get the answer, instead of one


  • -106
    jay_hag  commented on Oct. 22, 2019, 10:09 p.m.

    This comment is hidden due to too much negative feedback. Show it anyway.


    • 21
      planeloverten  commented on May 26, 2021, 11:08 p.m.

      But not everyone is as skilled as you


    • 6
      cyopotatoe  commented on June 10, 2020, 2:02 p.m.

      Thanks, no thanks :)