use itertools::Itertools; use proconio::{input, marker::Chars}; fn main() { input! { n: usize, mut s: Chars, } let happy = "HAPPY".chars().collect_vec(); let mut ans = 0; for i in 0..5 { if s[n - 5 + i] != happy[i] { ans += 1; } } s.truncate(n - 5); while let Some(suffix) = s.last_chunk_mut::<5>() { if &suffix[..] == &happy { suffix[0] = '.'; ans += 1; } s.pop(); } println!("{ans}"); }