#include using namespace std; int main(){ string N; cin >> N; int L = N.size(); string S; for (int i = 0; i < L; i++){ int p = N[i] - 'A' + 10; for (int j = 3; j >= 0; j--){ if ((p >> j & 1) == 1){ S += '1'; } else { S += '0'; } } } while (S.size() % 3 != 0){ S = '0' + S; } int L2 = S.size(); vector cnt(8, 0); for (int i = 0; i < L2; i += 3){ int p = (S[i] - '0') * 4 + (S[i + 1] - '0') * 2 + (S[i + 2] - '0'); cnt[p]++; } int mx = 0; for (int i = 0; i < 8; i++){ mx = max(mx, cnt[i]); } vector ans; for (int i = 0; i < 8; i++){ if (cnt[i] == mx){ ans.push_back(i); } } int cnt2 = ans.size(); for (int i = 0; i < cnt2; i++){ cout << ans[i]; if (i < cnt2 - 1){ cout << ' '; } } cout << endl; }