Compress string using counts. Example: 'aaabbcccc' => 'a3b2c4'. If single occurrence, use just the character.
Implement this function:
def compress(s: str) -> str:
Write the function only — the arguments are read for you and the return value is printed automatically.
Arguments arrive as one Python literal per line, in this order: s.
Input
'aaabbcccc'
Output
'a3b2c4'