#include #include char str[60000]; int str_len = 0; /// /// グローバル変数strの中身を入力された文字列で上書きする /// void ReadString() { char c = getchar(); str_len = 0; while (c != '\n') { str[str_len] = c; c = getchar(); str_len++; } } int main() { ReadString(); int cnt = 0; int stby = 0; for (int i = 1;i < str_len;i++) { if (str[i] == 'i' && str[i - 1] == 'm' && stby == 0) { stby = 1; continue; } if (stby == 1 && str[i] == 'n') { cnt++; stby = 0; } if (str[i] == '-') continue; if (str[i] != 'n') stby = 0; } printf("%d\n", cnt); }