Solution to Dictionary Exercise