#include #include #define rep(i, n) for (i = 0; i < n; i++) int main() { int i, j, k, l; int h, w; scanf("%d %d", &h, &w); getchar(); bool s[50][50], f[50][50], f2 = false; rep(i, h) { rep(j, w) { s[i][j] = f[i][j] = (getchar() == '#' ? true : false); if (!f2 && s[i][j]) f2 = true; } getchar(); } if (!f2) { puts("NO"); return 0; } int dy, dx; for (dy = -h + 1; dy < h; dy++) for (dx = -w + 1; dx < w; dx++) { if (dy == 0 && dx == 0) continue; f2 = true; rep(i, h) rep(j, w) { if (!f[i][j]) continue; int y = i + dy, x = j + dx; if (!(0 <= y && y < h && 0 <= x && x < w) || !f[y][x]) { rep(k, h) rep(l, w) f[k][l] = s[k][l]; f2 = false; break; } else f[i][j] = f[y][x] = false; } if (f2) { puts("YES"); return 0; } } puts("NO"); return 0; }