solve exercise 3.24

slight modification of sample code
a version that can run exercise 3.25

notice: key cannot be prefixed.

for example:
when key `(1 2) is used, any key prefixed with `(1 2) cannot be used.