input: def optimize_equation(equation: str) -> str:
      """This function optimizes an input equation by combining like terms.
      It splits the equation by '+' to isolate each term, then counts the occurrences 
      of each variable and combines them into a single term. The output is a string 
      representing the optimized equation where like terms are combined.
      Example:
      >>> optimize_equation('x + x + y + y + y')
      'x^2 + y^3'
      """
output:     terms = equation.split(' + ')
      term_count = {}
  
      for term in terms:
          if term in term_count:
              term_count[term] += 1
          else:
              term_count[term] = 1
  
      optimized_terms = []
      for term, count in term_count.items():
          if count > 1:
              optimized_terms.append(f"{term}^{count}")
          else:
              optimized_terms.append(term)
  
      return ' + '.join(optimized_terms)