Run ID:160547

提交时间:2026-09-21 21:08:02

#include <bits/stdc++.h> using namespace std; int main() { string s; while (cin >> s) { if (s == "#") break; int n = s.size(); char f = s[n - 1]; string a = s.substr(0, n - 1); int c = 0; for (int i = 0; i < a.size(); i++) { if (a[i] == '1') c++; } if (f == 'e') { cout << a << (c % 2 == 1 ? '1' : '0') << endl; } else { cout << a << (c % 2 == 1 ? '0' : '1') << endl; } } return 0; }