#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mk make_pair
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pa;
int main() {
int t;
cin >> t;
while (t--) {
string s;
cin >> s;
int cur = 0, ans = 0;
for (int i = 0; i < sz(s); i++) {
if (s[i] == 'X') cur = 0;
else {
ans += ++cur;
}
}
cout << ans << endl;
}
return 0;
}