AT_abc422_b [ABC422B] Looped Rope
Description
There is a grid with $ H $ rows and $ W $ columns. Let $ (i,j) $ denote the cell at the $ i $ -th row $ (1\le i\le H) $ from the top and the $ j $ -th column $ (1\le j\le W) $ from the left.
Each cell is painted with one color, white or black. The color painted on the cells is represented by $ H $ strings $ S _ 1,S _ 2,\ldots,S _ H $ . When the $ j $ -th character $ (1\le j\le W) $ of $ S _ i\ (1\le i\le H) $ is `.`, cell $ (i,j) $ is painted white, and when the $ j $ -th character $ (1\le j\le W) $ of $ S _ i\ (1\le i\le H) $ is `#`, cell $ (i,j) $ is painted black.
Determine whether the grid satisfies the following condition:
- For every black cell, the number of horizontally or vertically adjacent cells that are painted black is $ 2 $ or $ 4 $ .
Here, cells $ (i,j)\ (1\le i\le H,1\le j\le W) $ and $ (k,l)\ (1\le k\le H,1\le l\le W) $ are horizontally or vertically adjacent if and only if $ |i-k|+|j-l|=1 $ .
Input Format
The input is given from Standard Input in the following format:
> $ H $ $ W $ $ S _ 1 $ $ S _ 2 $ $ \vdots $ $ S _ H $
Output Format
Output `Yes` if the given grid satisfies the condition, and `No` if it does not satisfy the condition.
Explanation/Hint
### Sample Explanation 1
For example, cell $ (6,3) $ is painted black, and among the adjacent cells $ (5,3),(6,2),(6,4),(7,3) $ , cells $ (5,3) $ and $ (6,4) $ are painted black, which is $ 2 $ cells, so it satisfies the condition.
Every other black cell also satisfies the condition, so output `Yes`.
### Sample Explanation 2
Cell $ (1,1) $ is painted black, but it has only one adjacent cell, so it does not satisfy the condition.
Therefore, output `No`.
### Sample Explanation 3
There are no black cells, so the condition is satisfied.
Therefore, output `Yes`.
### Constraints
- $ 1\le H\le 20 $
- $ 1\le W\le 20 $
- $ H $ and $ W $ are integers.
- $ S _ i $ is a string of length $ W $ consisting of `.` and `#` $ (1\le i\le H) $ .