problem 1 updated with no duplication