#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i,a,n) for(int i=a,_n=n;i<_n;++i) #define per(i,a,n) for(int i=(n)-1,_a=a;i>=_a;--i) #define all(x) (x).begin(),(x).end() #define PB push_back #define MP make_pair #define ff first #define ss second #define siz(x) ((int)(x).size()) #define accu accumulate #define two(x) (1<<(x)) #define twol(x) (1ll<<(x)) #define clr(a) memset(a,0,sizeof(a)) #define debug(x) cout<<#x<<" = "< vi; typedef vector vs; typedef double db; typedef long long ll; typedef long double ldb; typedef unsigned int uint; typedef unsigned long long ull; typedef pair pii; typedef vector vpii; const int inf=0x20202020; const int mod=1000000007; const db eps=1e-9; const db pi=3.1415926535897932384626; int powmod(int a,int b){int res=1;a%=mod;for(;b;b>>=1){if(b&1)res=(ll)res*a%mod;a=(ll)a*a%mod;}return res;} inline void rd(int &res){ char c;res=0; while(c=getchar(),c<48); do res=res*10+(c^48); while(c=getchar(),c>47); } inline void Max(int &a,int b){if(ab)a=b;} inline void add(int &a,int b){a+=b;if(a>=mod)a-=mod;} char str[10005]; int n; void solve(){ scanf("%s",str+1); n=strlen(str+1); int ans=0; for(int i=1;i<=n>>2;i++){ if(str[i]!='y'&&str[i]!='x')continue; for(int j=2;i*j*j<=n;j++) if((str[i]=='y'&&str[i*j]=='r'&&str[i*j*j]=='x')||(str[i]=='x'&&str[i*j]=='r'&&str[i*j*j]=='y')) ans++; } printf("%d\n",ans); } int main(){ int T; rd(T); while(T--)solve(); return 0; }