input: Write a function to optimize an equation by combining like terms. The function should take a string equation where terms are separated by " + " and each term is followed by a space and the number of times it appears. The function should return a string with the optimized equation where each term is expressed in the form "variable^count". If the given equation is empty then return an empty string.
  assert optimize_equation("x + x + y + y + y")=="x^2 + y^3"
  assert optimize_equation("a + a + a + b + b")=="a^3 + b^2"
  assert optimize_equation("z + z + z + z")=="z^4"
  assert optimize_equation("x + y")=="x^1 + y^1"
  assert optimize_equation("")==""
output: def optimize_equation(equation):
      if not equation:
          return ""
      terms = equation.split(" + ")
      term_count = {}
      for term in terms:
          var = term.split()[0]
          count = int(term.split()[1])
          if var in term_count:
              term_count[var] += count
          else:
              term_count[var] = count
      optimized_terms = [f"{var}^{count}" for var, count in term_count.items()]
      return " + ".join(optimized_terms)