Updated Problem 37 to use a dictionary instead of a list.