input: Write a python function to evaluate a polynomial at a given value of x.
  assert evaluate_polynomial("4x^3 + 7x + 2", 6) == 890
  assert evaluate_polynomial("3x^2 + 5x^1 + 6", 2) == 26
  assert evaluate_polynomial("5x^4 + 4x^3 + 3x^2 + 2x + 1", 1) == 15
output: def evaluate_polynomial(poly_str, x):
      terms = poly_str.replace("-", "+-").split("+")
      result = 0
      for term in terms:
          if term:
              if 'x' in term:
                  if '^' in term:
                      coeff, power = term.split('x^')
                      coeff = int(coeff) if coeff else 1
                      power = int(power)
                  else:
                      coeff = int(term.split('x')[0]) if term.split('x')[0] else 1
                      power = 1
              else:
                  coeff = int(term)
                  power = 0
              result += coeff * (x ** power)
      return result