CCC '15 J2 - Happy or Sad

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 2.0s
Memory limit: 256M

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

We often include emoticons in our text messages to indicate how we are feeling. The three consecutive characters :-) indicate a happy face and the three consecutive characters :-( indicate a sad face. Write a program to determine the overall mood of a message.

Input Specification

There will be one line of input that contains between 1 and 255 characters.

Output Specification

The output is determined by the following rules:

  • If the input line does not contain any happy or sad emoticons, output none.
  • Otherwise, if the input line contains an equal number of happy and sad emoticons, output unsure.
  • Otherwise, if the input line contains more happy than sad emoticons, output happy.
  • Otherwise, if the input line contains more sad than happy emoticons, output sad.

Sample Input 1

How are you :-) doing :-( today :-)?

Output for Sample Input 1

happy

Sample Input 2

:)

Output for Sample Input 2

none

Sample Input 3

This :-(is str :-(:-a(nge te:-)xt.

Output for Sample Input 3

sad

Comments


  • -4
    andrewlii0729  commented on Jan. 23, 2026, 11:23 p.m.

    im the best coder ever lived


    • -1
      mrZ7  commented on Jan. 25, 2026, 9:28 p.m.

      ur not terry davis


  • -1
    ShibaInu140  commented on Jan. 15, 2026, 3:33 p.m.

    i took like 5 min trying to fix my code turns out the order of my statements were wrong


  • -1
    ShibaInu140  commented on Jan. 15, 2026, 3:24 p.m.

    can we use string.count


  • -3
    jimryanpro  commented on Jan. 7, 2026, 2:44 a.m.

    Friendly Hint: Remember, conditional statements execute on the first 'condition' that is met, so pay attention to the order.


  • -3
    Another_User  commented on Jan. 7, 2026, 12:18 a.m.

    I'm feeling :-) today!!!