#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define prt(x) cout<<#x<<":"<=i##_;--i) #define inf (1<<30) #define INF (1LL<<62) #define sqr(x) ((x)*(x)) #define pb push_back #define NOO puts("-1"),0 #define BE(x) (a).begin(),(a).end() typedef long long ll; typedef double db; typedef vector VI; typedef vector MT; typedef vector VD; typedef vector VS; struct ii { int x,y; ii(int x=0,int y=0):x(x),y(y){} bool operator<(const ii &a)const{if(x!=a.x)return xvoid sc(T &x) { x=0;char c;int f=1; while(c=getchar(),c<48)if(c=='-')f=-1; do x=x*10+(c^48); while(c=getchar(),c>47); x*=f; } templatevoid nt(T x) { if(!x)return; nt(x/10);putchar(x%10+'0'); } templatevoid pt(T x) { if(x<0)putchar('-'),x=-x; if(!x)putchar('0');else nt(x); } templatevoid pts(T x) { pt(x);putchar(' '); } templatevoid ptn(T x) { pt(x);putchar('\n'); } templatevoid pp(v x,int y) { static char ch[]={" \n"}; pt(x);putchar(ch[y]); } templatevoid PP(T *x,int y) { rep(i,0,y)pp(x[i],i==y-1); } templatevoid Max(T &x,T y){if(xvoid Min(T &x,T y){if(x>y)x=y;} /* template ends here */ const int maxn=10005; char s[maxn]; void solve() { scanf("%s",s+1); int n=strlen(s+1); int ans=0; rep(i,2,n+1) { rep(j,1,n+1) { ll x=j,y=x*i,z=y*i; if(z>n)break; if(s[x]=='y'&&s[y]=='r'&&s[z]=='x')ans++; if(s[x]=='x'&&s[y]=='r'&&s[z]=='y')ans++; } } ptn(ans); } int main() { // freopen("pro.in","r",stdin); // freopen("chk.out","w",stdout); int cas;sc(cas); while(cas--)solve(); return 0; }