Given a list of characters `chars`, compress them in-place using the following algorithm: replace sequences of repeating characters with the character followed by the count of repeats. Return the length of the compressed array.
chars = array of characters
length of compressed array after compression
Example 1:
Input:
chars = ["a","a","b","b","c","c","c"]
Output:
6
Explanation:
Compress to ["a","2","b","2","c","3"], length 6.
Example 2:
Input:
chars = ["a"]
Output:
1
Explanation:
Single char remains ["a"], length 1.
Example 3:
Input:
chars = ["a","b","b","b","b","b","b","b","b","b","b","b","b"]
Output:
4
Explanation:
Compress to ['a','1','b','12'], length 4.