input: def compress(s): 
      """Compress a given string by replacing all repeating characters with a single instance and its count.
      >>> compress("aabbbbbbcccc")
      '2a6b4c'
      >>> compress("a")
      '1a'
      >>> compress("aaabbb")
      '3a3b'
      """
      # Initialize result 
      result = "" 
    
      # Initialize count 
      count = 1
    
      # Traverse the string 
      for i in range(len(s) - 1): 
            
          # If the current character is the same 
          # as the next one, increment its count 
          if s[i] == s[i + 1]: 
              count += 1
          else: 
              # Append the count and character to the result 
              result += str(count) + s[i] 
            
              # Reset the count  
              count = 1
            
      # Append the last obtained character and its count 
      result += str(count) + s[-1]
    
      return result
output:     # Initialize result 
      result = "" 
    
      # Initialize count 
      count = 1
    
      # Traverse the string 
      for i in range(len(s) - 1): 
            
          # If the current character is the same 
          # as the next one, increment its count 
          if s[i] == s[i + 1]: 
              count += 1
          else: 
              # Append the count and character to the result 
              result += str(count) + s[i] 
            
              # Reset the count  
              count = 1
            
      # Append the last obtained character and its count 
      result += str(count) + s[-1]
    
      return result