#define PROC "a" #ifdef unix #define RE "%lld" #else #define RE "%I64d" #endif #include #include #include #include #include using namespace std; char s[10004]; int len; int main() { // freopen(PROC".in", "r", stdin); int T; scanf("%d", &T); while (T --) { scanf("%s", s + 1); len = (int) strlen(s+1); int ans = 0; for (int i = 1; i <= len / 4 + 1; ++ i) if (s[i] == 'y' || s[i] == 'x') { char c = 'y' + 'x' - s[i]; for (int k = 2; i * k * k <= len; ++ k) if (s[i*k]=='r'&&s[i*k*k]==c) ans ++; } printf("%d\n", ans); } return 0; }