0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-27 08:31:58 +00:00
OI-codes/problem/P2562/P2562.cpp
2020-11-03 17:34:22 +08:00

21 lines
372 B
C++

#include <bits/stdc++.h>
using namespace std;
string work(string s) {
if (s.find('1') == string::npos) {
return "A";
}
if (s.find('0') == string::npos) {
return "B";
}
return "C" + work(s.substr(0, s.size() / 2)) + work(s.substr(s.size() / 2));
}
int main() {
string s;
cin >> s;
cout << work(s) << endl;
return 0;
}