Add ungets method.

Exercise 4-7.