25
1
Write a program that accepts as input an emoticon and ouputs if the emoticon is happy or sad.
The program accepts a string as input or parameter, and should display the string "happy" if the input is in the happy emoticon list, or "sad" if the input is in the sad emoticon list.
You can assume the input is always a valid (happy or sad) emoticon, with no space or tabs around.
Here is a space separated list of happy emoticons:
:-) :) :D :o) :] :3 :c) :> =] 8) =) :} :^) :-D 8-D 8D x-D xD X-D XD =-D =D =-3 =3 B^D (-: (: (o: [: <: [= (8 (= {: (^:
Here is a space separated list of sad emoticons:
>:[ :-( :( :-c :c :-< :< :-[ :[ :{ 8( 8-( ]:< )-: ): >-: >: ]-: ]: }: )8 )-8
This is code-golf, so the shortest program wins.
1You forgot about
:'D
,:')
(happy) and:@
(angry) – Ismael Miguel – 2015-09-13T00:11:16.507