input: def compress(s: str) -> str:
      """ Compress a given string by replacing all repeating characters with a single instance
      and its count.
      >>> compress("aabbbbbbcccc")
      '2a6b4c'
      >>> compress("aaabbbccc")
      '3a3b3c'
      >>> compress("abcdef")
      '1a1b1c1d1e1f'
      """
output:     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(f"{count}{s[i - 1]}")
              count = 1
      
      compressed.append(f"{count}{s[-1]}")
      
      return "".join(compressed)