It's Friday and a long weekend is upon us, so let's have a round of code golf!
Nowadays, it's rare to find a text message without at least one emoji. 😃😄😎🙂😊😀😁😆😂
But back in the day, people had to be creative to express their emotions in text. They would use emoticons, which are symbols made up of keyboard characters :^) =] ) B).
Our challenge for today is to create a function that receives a string as argument and returns the total number of smiling faces or happy faces.
Each smiley face must have one smiling mouth, which should be marked with ), ], }, D or >.
A smiley face can have a pair of eyes but it does not have to. Valid characters for eyes are :, ;, 8, B or =.
A nose is optional, and can be represented these characters: -, ^, c, o and ~.
Valid smiley face examples:
:) :D ;-D :~) :‑) :-] =)
:] :-> :> 8-) :D 8‑D )
8) :-} :} :o) :c) :^) =]
:‑D 8D =D B^D
Input
"count how many smiley faces are here :)"
Output
1