#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; inline string hex2oct(string hex) { int dec = stoi(hex, nullptr, 16); string oct = ""; while (dec > 0) { oct = to_string(dec % 8) + oct; dec /= 8; } return oct; } int main() { string s; cin >> s; vector cnt(8, 0); string t = ""; for (char c : s) { if (t.size() == 3) { string u = hex2oct(t); for (char d : u) cnt[d - '0']++; t = ""; } t += c; } string u = hex2oct(t); for (char d : u) cnt[d - '0']++; t = ""; int maxim = 0; rep(i, 8) maxim = max(maxim, cnt[i]); Debug(maxim); rep(i, 8) { if (cnt[i] == maxim) cout << i << " "; } cout << endl; return 0; }