zcmu——1012

关键在于如何判断相同

首先双重循环,相同的字母除第一个外,全部为0

再循环

计数:不为0的字母

#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[100];
    int i,j,count;
    while(cin>>s)
    {
        count=0;
        int len=strlen(s);
        for(i=0;i<len;i++)
        {
            for(j=0;j<len;j++)
            {
                if(s[i]==s[j]&&i!=j)
                    s[j]=0;
            }
        }
        for(j=0;j<len;j++)
        {
            if(s[j]!=0)
                count++;
        }
        if(count%2==1)
        {
            printf("IGNORE HIM!\n");
        }
        else
        printf("CHAT WITH HER!\n");

    }
    return 0;
}
 

猜你喜欢

转载自blog.csdn.net/qq_42232118/article/details/81281973