title: Convert string to grouped by letters
body: <p>How I can create regex that converts a string to another string which is grouped by letters or numbers:</p>
  
  <pre><code>$string = "cucumber";
  </code></pre>
  
  <p>After regex: <code>ccuumber</code></p>
  
  <pre><code>$string = "tohothin";
  </code></pre>
  
  <p>After regex: <code>ttoohhin</code></p>
  
  <p>How I can create this with PHP? It is not important with regex, it may be another function.</p>