Run ID:160551

提交时间:2026-09-22 19:59:34

#include <iostream> #include <string> using namespace std; int main() { string s; while (cin >> s) { // 逐组读入 if (s[0] == '#') break; // 遇到 # 结束 // 统计 '1' 的个数(最后一个字符是校验字母,不参与统计) int ones = 0; for (int i = 0; i < s.length() - 1; i++) { if (s[i] == '1') ones++; } char check = s[s.length() - 1]; // 校验字母 e 或 o // 判断实际奇偶性与期望是否一致 if (check == 'e') { // 期望为偶性 if (ones % 2 == 0) cout << "even" << endl; else cout << "odd" << endl; } else { // 期望为奇性 (check == 'o') if (ones % 2 == 1) cout << "odd" << endl; else cout << "even" << endl; } } return 0; }