#include using namespace std; const int maxn = 100010; char s[maxn]; int main() { //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); int tt,cas=0; scanf("%d\n",&tt); while (tt--) { gets(s); int n=strlen(s); long long ans=0,now=0; for (int i=0; i