236A. Boy or Girl

  • time limit per test1 second
  • memory limit per test256 megabytes
  • inputstandard input
  • outputstandard output

Those days, many boys use beautiful girls' photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nice chat with a beauty (he thought so). After that they talked very often and eventually they became a couple in the network.

那些日子里,许多男孩在论坛上使用漂亮女孩的照片作为化身。因此,很难一眼就看出用户的性别。去年,我们的英雄去了一个论坛,和一个美女聊了一聊(他也这么认为)。在那之后,他们经常交谈,最终在网络中成为了一对情侣。

But yesterday, he came to see "her" in the real world and found out "she" is actually a very strong man! Our hero is very sad and he is too tired to love again now. So he came up with a way to recognize users' genders by their user names.

但昨天,他在现实世界中看到了“她”,发现“她”其实是一个非常强壮的男人!我们的英雄非常悲伤,他太累了,现在不能再爱了。所以他想出了一种通过用户名识别用户性别的方法。

This is his method: if the number of distinct characters in one's user name is odd, then he is a male, otherwise she is a female. You are given the string that denotes the user name, please help our hero to determine the gender of this user by his method.

这是他的方法:如果一个人的用户名中不同字符的数量是奇数,那么他是男性,否则她是女性。您将获得表示用户名的字符串,请帮助我们的英雄通过他的方法确定该用户的性别。

Input

The first line contains a non-empty string, that contains only lowercase English letters — the user name. This string contains at most 100 letters.

第一行包含一个非空字符串,它只包含小写英文字母——用户名。此字符串最多包含100个字母。

Output

If it is a female by our hero's method, print "CHAT WITH HER!" (without the quotes), otherwise, print "IGNORE HIM!" (without the quotes).

按照我们英雄的方法,如果是女性,请打印“与她聊天!”(不带引号),否则,打印“忽略他!”(没有引用)。

Examples
input1

wjmzbmr

output1

CHAT WITH HER!

input2

xiaodao

output2

IGNORE HIM!

input3

sevenkplus

output3

CHAT WITH HER!

Note

For the first example. There are 6 distinct characters in "wjmzbmr". These characters are: "w", "j", "m", "z", "b", "r". So wjmzbmr is a female and you should print "CHAT WITH HER!".

第一个例子。“wjmzbmr”中有6个不同的字符。这些字符是:“w”、“j”、“m”、“z”、“b”、“r”。所以wjmzbmr是女性,你应该打印“与她聊天!”。

Solution

用字母的ASCII码值来做统计数组的下标,如果该字母存在,则对应的数组内flag[letter-'a']设为1,然后再累加flag即可。

Code
#include <iostream>
using namespace std;

//236A. Boy or Girl
int main() {
    string str;
    cin >> str;
    int len=str.size();
    int sum =0;
    int flag[26]={0};
    for(int i=0;i<len;i++){
        int temp = str[i]-'a';
        flag[temp]=1;
    }
    for(int j=0;j<26;j++){
        sum+=flag[j];
    }
    if(sum%2==0)
        cout<<"CHAT WITH HER!"<<endl;
    else
        cout<<"IGNORE HIM!"<<endl;
}