题目:​​http://acm.hdu.edu.cn/showproblem.php?pid=2700​

‘e'代表偶校验,使串中’1‘的个数为偶数个
’o'代表奇校验,使串中‘1’的个数为奇数个 #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int a,b;
string s;
while(cin>>s&&s!="#")
{
a=0,b=0;
for(int i=0;i<s.length();i++)
{
if(s[i]=='1')
a++;
if(s[i]=='0')
b++;
}
a%=2;
b%=2;
if(s[s.length()-1]=='e')
{
if(a)
s[s.length()-1]='1';
else
s[s.length()-1]='0';
}
if(s[s.length()-1]=='o')
{
if(!a)
s[s.length()-1]='1';
else
s[s.length()-1]='0';
}
cout<<s<<endl;
}
return 0;
}