#include #include #include int main() { std::string str; std::cin >> str; for (int i = 0; i < str.length(); i++) { if (str[i] != 'K' && str[i] != 'U' && str[i] != 'R' && str[i] != 'O' && str[i] != 'I' && str[i] != '\?') { str.erase(str.begin() + i); i--; } } while(str.front() != 'K' && str.front() != '\?') str.erase(str.begin()); while (str.back() != 'I' && str.back() != '\?') str.erase(str.begin() + str.size() - 1); std::string s = "KUROI"; int pos = 0; std::vector d; int ans = 0; for (int i = 0; i < str.length(); i++) { if (str[i] == s[pos] || str[i] == '\?') { pos++; d.push_back(i); if (pos > 4) { pos = 0; for (int j = 0; j < 5; j++) { str[d[j]] = 'T'; } d.clear(); i = -1; ans++; } } if (i == str.length() - 1 && d.size() != 0) { str[d.front()] = 'T'; d.clear(); i = -1; } } std::cout << ans << std::endl; return 0; }