#include #include #include using namespace std; int ans[8]; int main(){ string s;cin>>s; reverse(s.begin(),s.end()); for(int i = 0; s.size() > i; i+=3){ string x; if(i+2 < s.size())x = s.substr(i,3); else x = s.substr(i,s.size()-i); reverse(x.begin(),x.end()); string c = ""; for(int j = 0; x.size() > j; j++){ int l = x[j]-'A'+10+16; string tmp = ""; while(l){ tmp.push_back((l%2)+'0'); l/=2; } tmp.pop_back(); reverse(tmp.begin(),tmp.end()); c += tmp; } while(c.size()%3)c = "0"+c; for(int j = 0; c.size() > j; j+=3){ ans[(c[j]-'0')*4+(c[j+1]-'0')*2+(c[j+2]-'0')]++; } } int mx = 0; vector mxar; for(int i = 0; 8 > i; i++){ if(mx < ans[i]){ mx = ans[i]; mxar.clear();mxar.push_back(i); }else if(mx == ans[i])mxar.push_back(i); } for(int i = 0; mxar.size() > i; i++){ cout << mxar[i] << " \n"[i+1==mxar.size()]; } }