use proconio::{input, marker::Chars}; fn main() { input! { s: Chars, }; let sz = s.len(); let mut poncount = 0; let mut painbool = false; for i in 0..sz-4 { if s[i..i+3] == ['p', 'o', 'n'] { poncount += 1; } if s[i..i+4] == ['p', 'a', 'i', 'n'] { painbool = true; break; } } if painbool { println!("{}", poncount); } else { println!("-1"); } }