// #[rustfmt::skip] // pub mod lib {pub use ac_library::*;pub use itertools::{join, Combinations, Itertools, MultiProduct, Permutations};pub use proconio::{input,marker::{Chars, Usize1}};pub use std::{cmp::*, collections::*, mem::swap};pub use regex::Regex;pub use superslice::Ext;pub use num_traits::{One, ToPrimitive, FromPrimitive, PrimInt};#[macro_export]macro_rules! degg {($($val:expr),+ $(,)?) => {println!("[{}:{}] {}",file!(),line!(),{let mut parts = Vec::new();$(parts.push(format!("{} = {:?}", stringify!($val), &$val));)+parts.join(", ")})}}} // use lib::*; use std::collections::{HashMap, HashSet}; // use itertools::Itertools; use proconio::{input, marker::{Chars, Usize1}}; fn main() { input! { h: usize, w: usize, mut s: [Chars; h] } for i in 0..h { for j in 0..w { if s[i][j] != '9' { continue; } if j == 0 { s[i][j + 1] = 'Y'; } else if j == w - 1 { s[i][j - 1] = 'Y'; continue; } else if s[i][j - 1] == 'y' { s[i][j - 1] = 'Y'; } else { s[i][j + 1] = 'Y'; } } let ans = s[i].iter().collect::(); println!("{}",ans); } }