#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); string n; cin >> n; map mp = { {'A', "1010"}, {'B', "1011"}, {'C', "1100"}, {'D', "1101"}, {'E', "1110"}, {'F', "1111"}, }; string nb = ""; for (char c : n) { nb += mp[c]; } reverse(nb.begin(), nb.end()); while (nb.size() % 3) { nb += "0"; } int l = nb.size(); int cnt[8] = {}; for (int i = 0; i < l; i += 3) { int x = 0; for (int j = 0; j < 3; j++) { x += (nb[i + j] - '0') * (1 << j); } cnt[x]++; } int ma = *max_element(cnt, cnt + 8); for (int i = 0; i < 8; i++) { if (cnt[i] == ma) { cout << i << " "; } } cout << endl; }