input: Write a python function to compress a string by collapsing consecutive identical characters into a single character followed by the count.
  assert compress_string('aaaaabbccd') == 'a5b2c2d1'
  assert compress_string('abc') == 'a1b1c1'
  assert compress_string('') == ''
  assert compress_string('aabbcc') == 'a2b2c2'
  assert compress_string('aaabbbcccaaa') == 'a3b3c3a3'
output: def compress_string(s):
      if not s:
          return ''
      
      compressed = []
      count = 1
      for i in range(1, len(s)):
          if s[i] == s[i - 1]:
              count += 1
          else:
              compressed.append(s[i - 1] + str(count))
              count = 1
      compressed.append(s[-1] + str(count))
      
      return ''.join(compressed)