Description
给出一个只由小写字母组成的字符串,如果出现的字母种类为奇数则输出IGNORE HIM!,是偶数则输出CHAT WITH HER!
Input
一个只由小写字母组成的字符串,字符串串长不超过100
Output
如果出现的字母种类为奇数则输出IGNORE HIM!,是偶数则输出CHAT WITH HER!
Sample Input
xiaodao
Sample Output
IGNORE HIM!
Solution
水题
Code
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f,maxn=100001;
char s[maxn];
int flag[33];
int main()
{
while(~scanf("%s",s))
{
memset(flag,0,sizeof(flag));
int n=strlen(s),num=0;
for(int i=0;i<n;i++)flag[s[i]-'a']=1;
for(int i=0;i<26;i++)num+=flag[i];
if(num%2==0)printf("CHAT WITH HER!\n");
else printf("IGNORE HIM!\n");
}
return 0;
}

本文介绍了一个简单的C++程序,该程序用于判断输入字符串中不同小写字母的数量是奇数还是偶数,并据此输出相应的提示信息。通过对输入字符串进行处理,程序能够统计出现的不同字母数量,并最终给出IGNOREHIM! 或 CHATWITHHER! 的反馈。
&spm=1001.2101.3001.5002&articleId=77824810&d=1&t=3&u=fdbc9d8f14ed41b2b505bf22e68c6f25)
2566

被折叠的 条评论
为什么被折叠?



