#include using namespace std; typedef long long LL; const int MAXN = 10000 + 5; int T; LL ans; char buf[MAXN]; int main() { scanf("%d", &T); while(T --) { scanf("%s", buf + 1); int N = strlen(buf + 1); ans = 0; for(int k = 1; k <= N; k++) { for(int b = 1; b * b * k <= N; b++) { if(buf[k] == 'y' && buf[k * b] == 'r' && buf[k * b * b] == 'x') { ans ++; } if(buf[k] == 'x' && buf[k * b] == 'r' && buf[k * b * b] == 'y') { ans ++; } } } printf("%I64d\n", ans); } return 0; }