input: Write a function to optimize an equation by reducing the terms in the form of "variable^count". The function should take an equation as a string where terms are separated by a '+' sign and return a new equation as a string where each term is in the "variable^count" format. If the equation is empty, return an empty string.
  assert optimize_equation('x + x + y + y + y')=='x^2 + y^3'
  assert optimize_equation('a + a + b + b + b + b')=='a^2 + b^4'
  assert optimize_equation('')==''
output: def optimize_equation(equation):
      if not equation:
          return ''
      terms = equation.split(' + ')
      count_dict = {}
      for term in terms:
          if term in count_dict:
              count_dict[term] += 1
          else:
              count_dict[term] = 1
      optimized_terms = [f"{term}^{count}" for term, count in count_dict.items()]
      return ' + '.join(optimized_terms)