input: Write a python function to compress a string such that repeated characters are represented by the character followed by the count of repetitions.
  assert compress("aabbbbbbcccc") == "2a6b4c"
  assert compress("abc") == "1a1b1c"
  assert compress("aaa") == "3a"
  assert compress("aabbcc") == "2a2b2c"
output: def compress(s):
      if not s:
          return ""
      
      compressed = []
      count = 1
      previous_char = s[0]
      
      for char in s[1:]:
          if char == previous_char:
              count += 1
          else:
              compressed.append(f"{count}{previous_char}")
              previous_char = char
              count = 1
      
      compressed.append(f"{count}{previous_char}")
      return ''.join(compressed)