CCC '15 J2 - Happy or SadView as PDF
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.
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
- 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 :-)?
Output for Sample Input 1
Sample Input 2
Output for Sample Input 2
Sample Input 3
This :-(is str :-(:-a(nge te:-)xt.
Output for Sample Input 3