# include using namespace std; string base_convert(string n, int from, int to) { int dec = stoll(n, nullptr, from); if (dec == 0) return "0"; string res; while (dec) { int d = dec % to; if (0 <= d and d <= 9) res += d + '0'; else res += d - 10 + 'A'; dec /= to; } reverse(res.begin(), res.end()); return res; } int main() { string s; cin >> s; string bin; for (char c : s) { bitset<4> b(c - 'A' + 10); bin.append(b.to_string()); } while (bin.length() % 3 != 0) bin = "0" + bin; string oct; for (size_t i = 0; i + 2 < bin.length(); i += 3) { string sub = bin.substr(i, 3); char c = base_convert(sub, 2, 8)[0]; oct.push_back(c); } int mx = 0; for (char c = '0'; c <= '7'; ++c) { mx = max(mx, int(count(oct.begin(), oct.end(), c))); } vector ans; for (char c = '0'; c <= '7'; ++c) { if (mx == int(count(oct.begin(), oct.end(), c))) { ans.push_back(c); } } for (size_t i = 0; i < ans.size(); ++i) { cout << ans[i] << " \n"[i + 1 == ans.size()]; } }