#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.size() > 0 && str.front() != 'K' && str.front() != '\?') str.erase(str.begin()); while (str.size() > 0 && 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]) { pos++; d.push_back(i); if (pos > 4) { for (int j = 0; j < 5; j++) { str[d[j]] = 'T'; } d.clear(); i = -1; ans++; pos = 0; } } if (i == str.length() - 1 && d.size() != 0) { i = d.front(); d.clear(); pos = 0; } } pos = 0; for (int i = 0; i < str.length(); i++) { if (str[i] == s[pos] || str[i] == '\?') { pos++; d.push_back(i); if (pos > 4) { for (int j = 0; j < 5; j++) { str[d[j]] = 'T'; } ans++; pos = 0; i = -1; d.clear(); } } if (i == str.length() - 1 && d.size() > 0) { str[d.front()] = 'T'; d.clear(); i = -1; pos = 0; } } std::cout << ans << std::endl; return 0; }