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.
There will be one line of input that contains between 1 and 255 characters.
The output is determined by the following rules:
- If the input line does not contain any happy or sad emoticons, output
- Otherwise, if the input line contains an equal number of happy and sad emoticons, output
- Otherwise, if the input line contains more happy than sad emoticons, output
- Otherwise, if the input line contains more sad than happy emoticons, output
Sample Input 1
How are you :-) doing :-( today :-)?
Sample Output 1
Sample Input 2
Sample Output 2
Sample Input 3
This:-(is str:-(:-(ange te:-)xt.
Sample Output 3
Point Value: 5
Time Limit: 2.00s
Memory Limit: 16M
Added: Feb 21, 2015
C++03, PAS, C, HASK, ASM, RUBY, PYTH2, JAVA, PHP, SCM, CAML, PERL, C#, C++11, PYTH3