input: Write a function to compress a given string by replacing all repeating characters with a single instance and its count.
  def compress(s):
      # Initialize results
      output = ""
    
      # Initialize count
      count = 1
    
      # Traverse the string
      for i in range(len(s)):
            
          # If the current character is same
          # as next one, increment its count
          if (i+1 < len(s) and s[i] == s[i+1]):
              count += 1
            
          else:
              # Append the count and character
              output += str(count) + s[i]
            
              # Reset the count
              count = 1
            
      # Append the last obtained characters
      # and their count
      output += str(count) + s[i]
    
      return output
  
  assert compress("aabbbbbbcccc") == "2a6b4c"
  assert compress("abcdef") == "1a1b1c1d1e1f"
  assert compress("") == ""
  assert compress("aa") == "2a"
  assert compress("aaaAAAbbCCCdd") == "3a3A2b3C2d"
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