title: Grouping spaces in Forsyth-Edwards notation
body: <p>In <a href="https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation" rel="nofollow noreferrer">Forsyth-Edwards notation</a>, I have a string like this:</p>
  
  <pre><code>string = rnbqkbnr/pppppppp/********/********/********/********/PPPPPPPP/RNBQKBNR
  </code></pre>
  
  <p>where <code>*</code> represents an empty space.
  It needs to be notated like this:</p>
  
  <pre><code>string = rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR
  </code></pre>
  
  <p>where the '8' represents the number of empty spaces.</p>
  
  <p>For example, given a string like this:</p>
  
  <pre><code>string = rnbqkbnr/pppppppp/*r*****/****p***/********/*******/PPPPPPPP/RNBQKBNR
  </code></pre>
  
  <p>The result should be:</p>
  
  <pre><code>string = rnbqkbnr/pppppppp/1r6/4p3/8/8/PPPPPPPP/RNBQKBNR
  </code></pre>
  
  <p>Can anyone help me in the right direction?</p>