Dilku and Bhopu live in Artland. Dilku loves Bhopu and he writes a message : “iloveyou”…
- User
Dilku and Bhopu live in Artland. Dilku loves Bhopu and he writes a message : “iloveyou” on paper and wishes to send it to Bhopu. As Dilku is busy making an artwork, he asks his friend Raj to send the message to Bhopu. However Raj has a condition that he may add/remove some characters and jumble the letters of the message. As Bhopu understands Dilku, she can read “iloveyou” from the message if all the characters of the string “iloveyou” are in the message received by her. Bhopu is happy if she can read “iloveyou” from the message. Otherwise, she is sad. Tell whether Bhopu is happy or sad. Input Input contains a string S, where S is the message received by Bhopu. String S consists of only lowercase letters.
Output Output “happy” if Bhopu is happy and “sad” if Bhopu is sad.
Constraints 1 ≤ |S| ≤ 100 Where |S| denotes length of message string S
Example Input 1: iloveyou
Output 1: happy
Input 2: ulrvysioqjifo
Output 2: sad
Input 3: abcvleouioydef
Output 3: happy
Assistant
pythonfrom collections import Counter s = input().strip() required = Counter("iloveyou") s_counts = Counter(s) happy = True for char, count in required.items(): if s_counts[char] < count: happy = False break print("happy" if happy else "sad")
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.