#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000001 int get(char c){ //cout<>s; while(s.size()%3!=0)s.insert(s.begin(),'0'); string t = ""; while(s.size()!=0){ string temp = s.substr(0,3); s.erase(s.begin(),s.begin()+3); int cur = 0; rep(i,temp.size()){ cur *= 16; cur += get(temp[i]); } //cout<0 && t[0]=='0')t.erase(t.begin()); vector c(8,0); rep(i,t.size())c[t[i]-'0']++; int M = 0; rep(i,8)M = max(M,c[i]); //cout<