#include #include #include #include #include #include #include #include #include int H, W; char field[64][64]; bool checked[64][64]; bool judge(int dr, int dc) { for(int i = 0; i < H; ++i) { for(int j = 0; j < W; ++j) { checked[i][j] = false; } } for(int r = 0; r < H; ++r) { for(int c = 0; c < W; ++c) { if( field[r][c] != '#' ) continue; if( checked[r][c] ) continue; int nr = r + dr; int nc = c + dc; if( not ( 0 <= nr and nr < H and 0 <= nc and nc < W ) ) return false; if( field[r+dr][c+dc] != '#' ) return false; checked[r+dr][c+dc] = true; } } return true; } int main() { // step 1 std::cin >> H >> W; for(int i = 0; i < H; ++i) { scanf("%s", field[i]); } // step 2 bool flag = false; [&](){ for(int r = 0; r < H; ++r) { for(int c = 0; c < W; ++c) { if( field[r][c] == '#' ) { flag = true; return; } } } }(); if( not flag ) { std::cout << "NO" << std::endl; return 0; } // step 3 bool res = false; [&](){ for(int dr = -H + 1; dr < H; ++dr) { for(int dc = -W + 1; dc < W; ++dc) { if( dr == 0 and dc == 0 ) continue; if( judge(dr, dc) ) { res = true; return; } } } }(); std::cout << (res ? "YES" : "NO") << std::endl; return 0; }