#include using namespace std; int main() { //freopen("C:\\Users\\Gary\\Desktop\\in.txt", "r", stdin); //freopen("C:\\Users\\Gary\\Desktop\\out.txt", "w", stdout); ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; while (t--) { string str; cin >> str; int i, j, n = str.size(), cnt = 0; for (i = 1; i <= n; ++i) { if (str[i-1] == 'y') { for (j = 2; i*j*j <= n; ++j) { if (str[i*j-1] == 'r' && str[i*j*j-1] == 'x') cnt++; } } else if (str[i-1] == 'x') { for (j = 2; i*j*j <= n; ++j) if (str[i*j-1] == 'r' && str[i*j*j-1] == 'y') cnt++; } } cout << cnt << endl; } }