Boy or Girl
Practice this coding question on Coding Gurukul.
Problem statement
A registration kiosk assigns one of two historical greeting messages to an anonymous screen name. Its legacy rule uses the variety of letters in the name, not its length or meaning. Your job is to reproduce this deterministic formatting rule so that an old display and a replacement display agree. The output labels are just fixed strings in the software protocol; they do not identify anything about the person using the name. Your task Count the distinct lowercase English letters in the supplied name. If that count is even, output CHAT WITH HER! Otherwise output IGNORE HIM! Repeated appearances of the same letter contribute only once. Important details Count different characters, not adjacent groups. The input is nonempty, so at least one distinct character is present. Preserve spaces, capitalization and punctuation in the output message. Worked example The name abac contains a, b and c: three distinct letters. Three is odd, so the kiosk prints IGNORE HIM!.
Input format
One lowercase word s.
Output format
Print CHAT WITH HER! for an even distinct count, otherwise IGNORE HIM!.
Constraints
1 <= length of s <= 100; only lowercase English letters.
Sample input
abac
Sample output
IGNORE HIM!
Sign in to run or submit a solution in C++, Java or Python.