title: Count continuous repeated occurrence of characters from String
body: <p>This is my code.</p>
  
  <pre><code>public static void countContinuosOccurence() {
      String first = "ABBCDDDEFGGH";
      StringBuffer result = new StringBuffer();
      int count = 1;
      for (int i = 1; i &lt; first.length(); i++) {
          if (first.charAt(i) == (first.charAt(i - 1))) {
              count++;
          } else {
              if (count &gt; 1) {
  
                  result.append(String.valueOf(count) + first.charAt(i - 1));
              } else {
                  result.append(first.charAt(i - 1));
              }
              count = 1;
          }
      }
      System.out.println("First String is:"+ first);
      System.out.println("Result is:" + result);
  }
  </code></pre>
  
  <p>The result is:</p>
  
  <pre><code>First String is:ABBCDDDEFGGH
  Result is:A2BC3DEF2G
  </code></pre>
  
  <p>It is missing the last character? May someone help me to solve this?</p>