fixed a code variable typo

Fixed a typo: changed the variable `ans` to `x`