input: Write a function to compress a given string by replacing all repeating characters with a single instance and its count.
  def compress(s): 
      output = "" 
      count = 1
      for i in range(len(s)): 
          if (i+1 < len(s) and s[i] == s[i+1]): 
              count += 1
          else: 
              output += str(count) + s[i] 
              count = 1
      output += str(count) + s[i] 
      return output
  
  s = "aabbbbbbcccc"
  print(compress(s))
  # Output: 2a6b4c
  assert compress("aabbbbbbcccc") == "2a6b4c"
  assert compress("aaabbcccaaa") == "3a2b3c3a"
  assert compress("abc") == "1a1b1c"
  assert compress("") == ""
  assert compress("aaax") == "3a1x"
  assert compress("a") == "1a"
output: def compress(s): 
      if not s:
          return ""
      output = "" 
      count = 1
      for i in range(1, len(s)): 
          if s[i] == s[i-1]: 
              count += 1
          else: 
              output += str(count) + s[i-1] 
              count = 1
      output += str(count) + s[-1] 
      return output