diff --git a/problem/P2562/P2562.cpp b/problem/P2562/P2562.cpp new file mode 100644 index 00000000..6bec7841 --- /dev/null +++ b/problem/P2562/P2562.cpp @@ -0,0 +1,20 @@ +#include + +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; +}