Hide & Seek Editorial

**Problem link:**Contest Page | CodeChef
Topics : Bit Mask
Explanation: In this problem, we want the number of ways to generate a given string. That will
be equal to the product of number of ways
to create each of its characters.
since, the character’s values will be between 0-63, so store all the possible ways
of creating each values.
ex: for string s = “V_V”,
let x is the number of ways to create ‘V’ i.e 31, and y is the number of ways to
create ‘_’
so the answer will be (xyx)

Code:
#include “bits/stdc++.h”
using namespace std;
#define MOD 1000000007
int main() {
#ifndef ONLINE_JUDGE
freopen(“input.txt”, “r”, stdin);
freopen(“output.txt”, “w”, stdout);
#endif
int ways[64]={0};
for(int i=0; i<64; i++) {
for(int j=0; j<64; j++) {
ways[i&j]++;
}
}
string s; cin>>s;
long long ans = 1;
// cout<<ways[0];
for(auto i: s) {
int digit;
if(i >= ‘0’ && i<= ‘9’) {
digit = i-‘0’;
} else if (i>=‘A’ && i<= ‘Z’) {
digit = i - ‘A’ + 10;
} else if (i>=‘a’ && i<=‘z’) {
digit = i - ‘a’ + 36;
} else if (i == ‘-’) {
digit = 62;
} else {
digit = 63;
}
ans = (ans*ways[digit])%MOD;
}
cout<<ans;
return 0;
}