2015 Canadian Computing Competition, Stage 1

Problem J2: Happy or Sad

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 the message.

Input

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

Output

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 :-)?

Sample Output 1

happy

Sample Input 2

:)

Sample Output 2

none

Sample Input 3

This:-(is str:-(:-(ange te:-)xt.

Sample Output 3

sad

All Submissions
Best Solutions


Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 21, 2015

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

Comments (Search)

As the title says

Trivial logic error. Create some test cases yourself.

um you put sample input 2 twice and no sample out???
pls fix

the problem says:
The three consecutive characters :-) indicate a happy face
:) is not a happy face, :-) is

I believe girishr is referring to the fact that "Sample Input 2" occurs twice in the statement:

http://puu.sh/lzWqx/9f3210b5a4.png

Oh i get it thanks

Corrected

Thank You applause.gif