title: how to search for consecutive repeated characters in a string without using any built-in php functions?
body: <p>I have been asked to solve this question. Please suggest me how to solve this.</p>
  
  <pre><code>$string = "kkjnmnmnjjjnmn";
  </code></pre>
  
  <p>here I need to find consecutively repeated string of length 3. for example - kkj has occurred only once and jnm 2 times and nmn 3 times.</p>
  
  <p>Starting from first character, going in right side direction, 3 consecutive characters which are repeated more than once should be the output.</p>
  
  <pre><code>Preg_match_all will result as nmn - 2 times and not as 3 times.
  </code></pre>
  
  <p>How to solve this?</p>