two ways to invert a dictionary