L-shapes

An L-shape is exactly three shaded cells (*) arranged as a 2 by 2 square with one cell removed. It may be rotated in any of the four ways.

Given a rectangular grid of . and *, decide whether the shaded cells form a collection of L-shapes that never touch each other, not even at a corner. Formally:

  • Every shaded cell belongs to exactly one L-shape.
  • No two L-shapes are adjacent by an edge or by a corner.

Return true when the grid satisfies both conditions, otherwise return false. A grid with no shaded cells is vacuously valid.

Examples
Input: ["........**",".**......*","..*..*....",".....**...","...*.....*","..**....**"]
Output: true
Hints

L-shapes

An L-shape is exactly three shaded cells (`*`) arranged as a 2 by 2 square with one cell removed. It may be rotated in any of the four ways.