#include<stdio.h>
#include<string.h>
#include<string>
//题解:字符串中如果有偶数个1就是e,有奇数个1就是o
using namespace std;
int main()
{
char num[110];
while(gets(num))
{
if(strcmp(num,"#")==0)break;
int len=strlen(num);
int temp1=0;
for(int i=0;i<len;i++)
{
if(num[i]=='1')
temp1++;
}
if(num[len-1]=='e')
{
if(temp1%2==0)
{
num[len-1]='0';
}
else
{
num[len-1]='1';
}
}
else
{
if(temp1%2==0)
{
num[len-1]='1';
}
else
{
num[len-1]='0';
}
}
puts(num);
memset(num,0,len);
}
}
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2700
题解:字符串中如果有偶数个1就是e,有奇数个1就是o. 首先知道字符串中的1的个数,在观察是e还是o。然后将最后的字符进行更改