#include int main(void) { char str[200000]; int count = 0, ponnum = 0, painnum = 0; int cheak = 0; scanf("%s", str); for (int i = 0; i < (sizeof str -sizeof str[0]); i++) { if (cheak) { break; } switch (str[i]){ case 'p': ponnum++; painnum++; break; case 'o': if (ponnum == 1) { ponnum++; }else { ponnum = 0; } painnum = 0; break; case 'n': if (painnum==3){ cheak = 1; } if (ponnum == 2) { count++; } ponnum = painnum = 0; break; case 'a': if (painnum == 1) { painnum++; } else{ painnum = 0; } ponnum = 0; break; case 'i': if (painnum == 2) { painnum++; } else { painnum = 0; } ponnum = 0; break; default: ponnum = painnum = 0; break; } } count--; if (count < 1) { count = -1; } printf("%d", count); }