class Solution {
public:
int minimumMoves(string s) {
int ans = 0;
int flag = 0;
int num = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] == 'X') {
flag++;
num++;
} else {
if (flag != 0) num++;
}
if (num == 3) {
num = 0;
flag = 0;
ans++;
}
}
if (num != 0) ans++;
return ans;
}
};