input: Write a function to compress a given string by replacing all repeating characters with a single instance and its count. If the given string is empty, return an empty string.
  assert compress("aabbbbbbcccc") == "2a6b4c"
  assert compress("aabbcc") == "2a2b2c"
  assert compress("abcd") == "1a1b1c1d"
  assert compress("") == ""
  assert compress("aaaaaa") == "6a"
output: def compress(s):
      if not s:
          return ""
      result = []
      count = 1
      for i in range(1, len(s)):
          if s[i] == s[i - 1]:
              count += 1
          else:
              result.append(f"{count}{s[i - 1]}")
              count = 1
      result.append(f"{count}{s[-1]}")
      return "".join(result)