#include #include #include #include #define MOD 1000000007 #define MOD1 998244353 #define MOD2 1000000007 #define MUL 99999971 char x[110]; std::vector< std::pair > index,ans; std::map< std::pair , int > hash; void hashF() { long long int sum1 = 0, sum2 = 0; for(int i=1;i<=9;i++) { sum1 *= MUL, sum2 *= MUL; sum1 += x[i], sum2 += x[i]; sum1 %= MOD1, sum2 %= MOD2; index.push_back(std::make_pair(sum1,sum2)); } ans.push_back(std::make_pair(sum1,sum2)); } char y[100010]; std::map< std::pair , long long int> count,count2; int main() { x[1] = 'y', x[2] = 'u', x[3] = 'k', x[4] = 'i', x[5] = 'c', x[6] = 'o', x[7] = 'd', x[8] = 'e', x[9] = 'r'; index.push_back(std::make_pair(0,0)); hashF(); for(int i=1;i<=9;i++) { char temp = x[i]; x[i] = '?'; hashF(); x[i] = temp; } std::sort(index.begin(),index.end()); for(int i=0;i ,long long int> ::iterator it = count.begin();it!=count.end();it++) { long long int sum1 = (it->first).first; long long int sum2 = (it->first).second; sum1 *= MUL, sum2 *= MUL, sum1 += y[i], sum2 += y[i], sum1 %= MOD1, sum2 %= MOD2; if(hash.find(std::make_pair(sum1,sum2))!=hash.end()) { count2[std::make_pair(sum1,sum2)] += (it->second), count2[std::make_pair(sum1,sum2)] %= MOD; } } for(std::map< std::pair ,long long int> ::iterator it = count2.begin();it!=count2.end();it++) { count[it->first] += (it->second), count[it->first] %= MOD; } } long long int sum = 0; for(int i=0;i