Using 'set' to solve the problem.