#include #include #define N_MAX 10000 typedef long long lnt; int T, n, i, q, ans; char S[N_MAX + 2]; int main() { scanf("%d", &T); while (T--) { ans = 0; scanf("\n%s", S + 1); n = int(strlen(S + 1)); for (i = 1; i <= n; ++i) for (q = 2; i * q * q <= n; ++q) ans += (S[i * q] == 'r' && ((S[i] == 'y' && S[i * q * q] == 'x') || (S[i] == 'x' && S[i * q * q] == 'y'))); printf("%d\n", ans); } return 0; }