#include using namespace std; typedef long long ll; #define ri register int int n,m,t,i,j,p[25],k,ans; char c[3000005]; int main() { scanf("%d",&t); while(t--) { scanf("%s",c); memset(p,0,sizeof(p)); for(i=0;c[i];i++) { for(j=i;c[j]=='?';j++); int s=j-i+1; for(k=1;(1<=1;k--) if(p[k]==0&&s>=(1<=1;i--) if(p[i]) ans+=(1<