#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#include #include #define rep(i,n) for(int i=0;i<(n);i++) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define sz(x) ((int)(x).size()) #define pb push_back using ll = long long; using namespace std; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> S; reverse(all(S)); vector cnt(8,0); string T=""; rep(i,sz(S)){ int a = (S[i]-'A')+10; rep(j,4) T+=(char)('0'+((a>>j)&1)); } while(sz(T)%3)T+='0'; rep(i,sz(T)/3){ string t = T.substr(i*3,3); int n=0; rep(j,3){ if(t[j]=='1') n+=(1< ans; rep(i,8){ if(cnt[i]==mx) ans.pb(i); } rep(i,sz(ans)){ if(i) cout << ' '; cout << ans[i]; } cout << endl; return 0; }