Delhi Coding League 2015--DCL2015B

hello,i took part in DCL2015 and this is my solution for DCL2015B .I am debugging this for 2 days but failed to find any fault.Can you please have a look at my solution

You are not sorting the strings.

I didn’t get you.Could you please elaborate.Whats the need of Storing strings

The output has to be given alphabetically as seen in a dictionary. You have to sort the strings to do the same.

Ohh i didn’t read that…my bad…thanks btw

First of all you didn’t sort and secondly after setting key as string in map,there was no need of creating a set, simply output the contents in map as they are already in lexicographic order.

Yes…you are right map has values sorted according to the key’s value…Actually what went wrong with me that i didn’t look at lexicographic order in the question(my bad).And i thought that we have to output in the same order as string was read.