input: Write a function to optimize a given equation by combining like terms. The input equation is a string where each term is separated by a plus sign ('+'). Each term is represented as a variable followed by its count. The function should return a new equation string where each variable is raised to the power of its count.
  assert optimize_equation('x + x + y + y + y')=='x^2 + y^3'
  assert optimize_equation('a + a + b + a')=='a^3 + b^1'
  assert optimize_equation('z + z + z + z')=='z^4'
  assert optimize_equation('x + y + z + x')=='x^2 + y^1 + z^1'
  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
      result = []
      for var, count in count_dict.items():
          result.append(f"{var}^{count}")
      return ' + '.join(result)