#include <iostream>
#include<string>
#include<cstdio>
using namespace std;
const int TYPE_COUNTS[4]={26,26,10,4};
int getCharType(char c){
if(isupper(c)){
return 0;
}else if(islower(c)){
return 1;
}else if(isdigit(c)){
return 2;
}else{
return 3;
}
}
long long countModifyWays(const string&s){
int cnt[4]={0};
for(char c:s){
int type=getCharType(c);
cnt[type]++;
}
long long total=0;
for(char c:s){
int type=getCharType(c);
if(cnt[type]-1==0){
total+=TYPE_COUNTS[type]-1;
}else{
total+=65;
}
}
return total;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin>>t;
cin.ignore();
while(t--){
string s;
getline(cin,s);
cout<<countModifyWays(s)<<'\n';
}
return 0;
}
// 64 位输出请用 printf("%lld")
字符数量分别为26,26,10,4,判断是否合法,并进行计算.

京公网安备 11010502036488号