This problem is very focused on transformation, the essence is actually the string of each character converted to the corresponding number, according to 6 bits of the binary conversion, and then statistics 0 occurrences of the number of times, 0&1=0,1&0=1,0&0=0, some people use a fast power, in fact, it is completely unnecessary, But be sure to use a long long.
#include <iostream> #include <cstdio> #include <string>using namespace Std;const long Long mod=1e9+7;string s;int getnum (char ch) {if (ch>= ' 0 ' &&ch<= ' 9 ') return ch-' 0 '; if (ch>= ' A ' && Ch<= ' z ') return ch-' a ' +10;if (ch>= ' a ' &&ch<= ' Z ') return ch-' a ' +36;if (ch== '-') return 62;if (ch= ' _ ') return 63;} Long Long Ans=1;int main () {cin>>s;for (int i=0;i<s.size (); i++) {int tag=getnum (s[i]); int cnt=0;for (int j=0;j <6;j++) {if (!) ( tag&1)) Cnt++;tag>>=1;} for (int i=1;i<=cnt;i++) Ans=ans*3%mod;} printf ("%i64d\n", ans); return 0;}
Codeforces Round #355 (Div. 2) Vanya and Label