#include<bits/stdc++.h>
using namespace std;
int main() {
int n, num = 0, all = 0;
cin >> n;
string s;
for (int i = 0; i < n; i++) {
cin >> s;
for (int j = 0; j < s.length(); j++) {
if (s[j] == 'O') {
if (s[j - 1] == 'O') {
num++;
} else if (s[j - 1] == 'X') {
num = 0;
}
}
all++;
}
cout << endl;
cout << all;
}
return 0;
}