code to dualize the dictionary