#include using namespace std; int main(void){ string s; cin >> s; string bstr; for (int i = (int)s.size()-1; i >= 0; i--) { bitset<4> b(stoi(s.substr(i, 1), nullptr, 16)); bstr = b.to_string() + bstr; } while (bstr.size()%3 != 0) { bstr = "0" + bstr; } string ostr; for (int i = (int)bstr.size()-3; i >= 0; i -= 3) { bitset<3> o(stoi(bstr.substr(i, 3), nullptr, 2)); ostr = to_string(o.to_ulong()) + ostr; } //take.max vector aoct(8); for (int i = 0; i < (int)ostr.size(); i++) { aoct[stoi(ostr.substr(i, 1))]++; } int mxs = -1; vector ans; for (int i = 0; i < 8; i++) { if (aoct[i] > mxs) { ans.resize(0); mxs = aoct[i]; ans.push_back(i); } else if (aoct[i] == mxs) { ans.push_back(i); } } for (int i = 0; i < (int)ans.size(); i++) { cout << ans[i] << ((i == (int)ans.size()-1) ? "\n" : " "); } }