#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; } Debug(hex, oct); return oct; } int main() { string s; cin >> s; vector cnt(8, 0); string t = ""; reverse(s.begin(), s.end()); for (char c : s) { if (t.size() == 3) { reverse(t.begin(), t.end()); string u = hex2oct(t); for (char d : u) cnt[d - '0']++; t = ""; } t += c; } if (t.size() > 0) { reverse(t.begin(), t.end()); string u = hex2oct(t); for (char d : u) cnt[d - '0']++; } 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; }