title: How to count groups of same cells in a 2d array?
body: <p>Here's the example (counting black ones):</p>
  
  <p>input:</p>
  
  <p><img src="https://i.stack.imgur.com/fDFJH.png" alt="enter image description here"></p>
  
  <p>output:</p>
  
  <pre><code>5 4 // 5 groups (4 squares each)
  1 1 // 1 group containing 1 square
  </code></pre>
  
  <p>For Now, I can't think of anything better than a painfull for iteration. Would it be possible to get these groups in a recursive way?
  Thanks</p>