JDCC '17 Contest 1 S2 - Hot Rodds

View as PDF

Submit solution

Points: 5 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type

In an effort to make his entire home Halloween-themed, Vlad has decided to get a new, scary license plate for his car. He would like the new license plate to contain the word spooky, however that license plate has been taken long ago.

Instead, the system recommends Vlad some available license plates. Vlad doesn't really mind what his new license plate is as long as it contains the word spooky. Furthermore, he doesn't care how many os are used in spooky, as long as there's at least two. For example, Vlad would be happy with spooooky123 as a license plate.

Given a license plate that was recommended to Vlad, determine whether it suits Vlad and if it does, how many os the word spooky contains.

Input Specification

The input contains one string with at most 100 000 characters of lowercase letters or numbers, the license plate recommended for Vlad. It is guaranteed that the string spooky (with at least two os) will appear at most once in the input.

For 50\% of cases, the string has at most 100 characters.

Output Specification

If Vlad is happy with the license plate, print Happy and the number of os that appear in the word spooky. Otherwise, print Sad.

Sample​ ​Input​ ​1

spooooky123

Sample​ ​Output​ ​1

Happy 4

Sample​ ​Input​ ​2

veryspookey123

Sample​ ​Output​ ​2

Sad

Comments

There are no comments at the moment.