#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; const int inf = 0x3f3f3f3f; const double eps=1e-8; const int maxn = 1e5+100; const int N = 1e6+100; const ll mod = 1e9+7; char s[maxn]; int main() { int T; cin>>T; while(T--) { scanf("%s",s); int len = strlen(s); ll cnt = 0; ll ans = 0; for(int i = 0; i < len; i++){ cnt = 0; while(i