Question 4
John wrote a 3-digit number on a piece of paper and asked Peter to guess it. Peter asked: “Is the number 123?” John replied: “One of the digits is correct. The position of that digit is correct.” Peter asked again: “Is the number 178?” John replied: “Two digits are correct. The positions of those digits are wrong.” Peter asked again: “Is the number 782?” John said: “All three digits are correct, but the digits are in the wrong places.” What is the number written by John?

