#include using namespace std; int countRegexSmatch(const string str, const string pattern) { regex pt(pattern); smatch mt; auto start = str.cbegin(); vector v; while (regex_search(start, str.cend(), mt, pt)) { v.emplace_back(mt.str()); start = mt[0].second; } return v.size(); } int countRegexIterator(const string str, const string pattern) { vector v; regex pt(pattern); std::sregex_iterator end, it{str.begin(), str.end(), pt}; for (; it != end; ++it) { v.emplace_back(it->str()); } return v.size(); } int solve() { string s; cin >> s; string p = "(mi-*n)"; return countRegexSmatch(s, p); } int main() { cin.tie(0); ios::sync_with_stdio(false); cout << solve() << endl; getchar(); } // mi--nminminminmi-------n // 5 // C++ 正規表現で検索文字列の抽出/出現位置の判定【match_results/std::regex】 // https://marycore.jp/prog/cpp/std-regex-match-results-match-count/