use std::io::Read; fn main() { let mut buf = String::new(); std::io::stdin().read_to_string(&mut buf).unwrap(); let mut iter = buf.split_whitespace(); let h: isize = iter.next().unwrap().parse().unwrap(); let w: isize = iter.next().unwrap().parse().unwrap(); let is_black: Vec> = iter.map(|s| s.chars().map(|c| c == '#').collect::>()).collect(); if !is_black.iter().any(|v| v.iter().any(|&b| b)) { println!("NO"); return } for v_move in -h+1..=h-1 { for h_move in -w+1..=w-1 { if v_move == 0 && h_move == 0 { continue } let mut is_black_c: Vec> = is_black.clone(); for i in 0..h { for j in 0..w { if is_black_c[i as usize][j as usize] { let i2: isize= i + v_move; let j2: isize = j + h_move; if i2 >= 0 && i2 < h && j2 >= 0 && j2 < w { if is_black_c[i2 as usize][j2 as usize] { is_black_c[i as usize][j as usize] = false; is_black_c[i2 as usize][j2 as usize] = false; } } } } } if !is_black_c.iter().any(|v| v.iter().any(|&b| b)) { println!("YES"); return } } } println!("NO"); }