How to exchange keys with values of a hash without losing any data even if there a are duplicate values in the original hash?