Word equations in simple groups and polynomial equations in simple algebras