in reply to print identical keys once along with their values

For your output, you may also want to look at join and keys. A HoH or HoA could work for collecting the data for your results.

You may also want to put <code>...</code> around both your input and output data in order to preserve your intended formatting.

--MidLifeXis