CF 236A boy or girl
2016-04-13 20:57
477 查看
A. Boy or Girl
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard 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
output
input
output
input
output
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代码:
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard 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 <bits/stdc++.h> using namespace std; int main() { char a[105]; while(cin>>a) { int len=strlen(a); sort(a,a+len); int n =unique(a,a+n)-a;//unique()去重函数 if(i%2==0) printf("CHAT WITH HER!\n"); else printf("IGNORE HIM!\n"); }return 0; }
相关文章推荐
- Matlab批量读取xls文件的总结
- Python urllib2的基本用法
- json数据格式
- hibernate单表之组件映射和继承映射
- 2019
- 对HashMap中的值进行排序
- CSS选择器详解一
- Android-view自定义-Canvas
- 回溯水题——置棋问题
- 【SDOI2014】数数
- poj 3259 Wormholes 最短路(Bellman_Ford)
- C#中的代码书写规范以及命名规范
- http协议详解之url篇
- ANR Warning,RemoteViews can only be used once ,if not 问题
- 几个性能测试工具
- c++学习之同名隐藏
- 大牛们的博客
- Bellman-Ford算法模板
- shell脚本学习笔记 (流编辑器sed)
- 素数环