#include<bits/stdc++.h>
#define int long long
using namespace std;
string s;
int ss;
bool ab(string x,int len){
bool a,b;
for(int i=0;i<len;i++){
if(x[i]>='1'&&x[i]<='9')
a=1;
else if(x[i]>='a'&&x[i]<='z'||x[i]>='A'&&x[i]<='Z')
;
else
b=1;
if(a==1&&b==1)
return 1;
}
return 0;
}
signed main(){
cin>>s;
int len=s.size();
for(int l=0;l<len;l++){
for(int r=l+7;r<min(len,l+16);r++){
string x=s.substr(l,r);
if(ab(x,r-l+1))
ss++;
}
}
cout<<ss;
}