#include #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; int main() { cin.tie(0); ios_base::sync_with_stdio(false); string S; cin >> S; vector bin; for (char &c : S) { int d = c - 'A' + 10; while (d) { bin.push_back(d % 2); d /= 2; } } if (bin.size() % 3 != 0) { int n = 3 - bin.size() % 3; rep(i, n) bin.push_back(0); } vector cnt(8); for (int i = 0; i < bin.size(); i += 3) { int cur = bin[i] + 2 * bin[i + 1] + 4 * bin[i + 2]; cnt[cur]++; } int ma = 0; rep(i, 8) ma = max(ma, cnt[i]); rep(i, 8) { if (cnt[i] == ma) cout << i << " "; } cout << "\n"; return 0; }