#include #include #include #include #include #include #include #include #include #include using ll = long long; using namespace std; int main() { string n, s = ""; int max1 = 0; cin >> n; vector v(8, 0), ans; for (int i = 0; i < n.size(); i++){ if (n[i] == 'A') s += "1010"; else if (n[i] == 'B') s += "1011"; else if (n[i] == 'C') s += "1100"; else if (n[i] == 'D') s += "1101"; else if (n[i] == 'E') s += "1110"; else s += "1111"; } while (s.size()>=3){ string t; t = s.substr(s.size()-3, 3); if (t == "000") v[0]++; else if (t == "001") v[1]++; else if (t == "010") v[2]++; else if (t == "011") v[3]++; else if (t == "100") v[4]++; else if (t == "101") v[5]++; else if (t == "110") v[6]++; else v[7]++; s.erase(s.size()-3, 3); } if (s == "1") v[1]++; else if (s == "10") v[2]++; else if (s == "11") v[3]++; for (int i = 0; i < 8; i++){ if (v[i] > max1){ max1 = v[i]; ans.clear(); ans.push_back(i); } else if (v[i] == max1) ans.push_back(i); } string delim = ""; for (auto x : ans){ cout << delim << x; delim = " "; } cout << endl; }