Python: String: Compress

Write the function compress that take a string and returns another string where each character is followed by its count and any neighboring same characters are removed.


compress('aaaZzzRbbbbghF') -> 'a3Zz2Rb4ghF'

Test 1    

Test 2    

Test 3    

Test 4    

Test 5    

Test 6