input: Write a function to optimize an equation by combining like terms and returning the simplified form. If the given equation is empty, 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('c + c + c + c + c') == 'c^5'
  assert optimize_equation('d + e + d') == 'd^2 + e'
  assert optimize_equation('') == ''
output: def optimize_equation(equation):
      if not equation:
          return ''
      
      terms = equation.split(' + ')
      term_count = {}
      
      for term in terms:
          if term in term_count:
              term_count[term] += 1
          else:
              term_count[term] = 1
      
      simplified_terms = []
      for term, count in term_count.items():
          if count > 1:
              simplified_terms.append(f"{term}^{count}")
          else:
              simplified_terms.append(term)
      
      return ' + '.join(simplified_terms)