<p>Given an array of characters <code>chars</code>, compress it using the following algorithm:</p>
<p>Begin with an empty string <code>s</code>. For each group of <strong>consecutive repeating characters</strong> in <code>chars</code>:</p>
<ul>
<li>If the group's length is <code>1</code>, append the character to <code>s</code>.</li>
<li>Otherwise, append the character followed by the group's length.</li>
</ul>
<p>The compressed string <code>s</code><strong>should not be returned separately</strong>, but instead, be stored <strong>in the input character array <code>chars</code></strong>. Note that group lengths that are <code>10</code> or longer will be split into multiple characters in <code>chars</code>.</p>
<p>After you are done <strong>modifying the input array,</strong> return <em>the new length of the array</em>.</p>
<p>You must write an algorithm that uses only constant extra space.</p>
<strong>Output:</strong> Return 6, and the first 6 characters of the input array should be: ["a","2","b","2","c","3"]
<strong>Explanation:</strong> The groups are "aa", "bb", and "ccc". This compresses to "a2b2c3".