use proconio::{fastout, input, marker::Bytes}; #[fastout] fn main() { input! { h: usize, _w: usize, s: [Bytes; h], } println!("{}", output(solve(s))); } fn solve(mut s: Vec>) -> Vec> { for s in &mut s { let mut j = 0; while j < s.len() && s[j] == b'.' { j += 1; } while j < s.len() { match s[j] { b'9' => { s[j + 1] = b'Y'; j += 6; } b'y' => { s[j + 4] = b'Y'; j += 6; } _ => (), } while j < s.len() && s[j] == b'.' { j += 1; } } } s } fn output(ans: Vec>) -> String { ans.into_iter() .map(|x| String::from_utf8(x).unwrap()) .collect::>() .join("\n") }