Given an array of characters, chars, compress it in place according to the following rules:
Start with an empty string s.
For each group of consecutive repeating characters in chars:
If the group length is s.
Otherwise, append the character followed by the group length.
The compressed string s should not be returned separately; instead, it must be written directly into the input character array chars. Note that if a group’s length is
Given an array of characters, chars, compress it in place according to the following rules:
Start with an empty string s.
For each group of consecutive repeating characters in chars:
If the group length is s.
Otherwise, append the character followed by the group length.
The compressed string s should not be returned separately; instead, it must be written directly into the input character array chars. Note that if a group’s length is