当前位置: 代码迷 >> 综合 >> Boy or Girl
  详细解决方案

Boy or Girl

热度:101   发布时间:2023-11-22 14:50:44.0

文章目录

  • 一、Boy or Girl
  • 总结


一、Boy or Girl

本题链接:Boy or Girl

题目

A. 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.

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

input
wjmzbmr

output
CHAT WITH HER!

input
xiaodao

output
IGNORE HIM!

input
sevenkplus

output
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!”.

本博客给出本题截图

在这里插入图片描述
在这里插入图片描述

题意:如果输入的字符串中字符相同的个数是奇数的话就是男生,反之是女生

AC代码

#include <iostream>using namespace std;const int N = 110;char s[N];
int res; int main()
{
    cin >> s;for (int i = 0; s[i]; i ++ ){
    bool flag = true;for (int j = 0; j < i; j ++ )if (s[i] == s[j])flag = false;if (flag) res ++;}if (res % 2) puts("IGNORE HIM!");else puts("CHAT WITH HER!");return 0;
}

总结

quote 引号
forum 论坛
avatar 化身
determine 造成

水题,不解释