WA in Blocked websites

My solution CodeChef: Practical coding for everyone
Just want to know for which test cases I am getting WA (I am not concerned with TLE as I am using brute force approach)

You should remove duplicates before printing

@hruday968 he is using a set which he later copies in a list to sort. So he is removing duplicates.

@rdfan19…after you read char and then site_name, instead of splitting them by space, split them by space or newline…What I mean is input files at codechef server may not be well formatted…Give it a try and let me know.

Please look at my submission.I have done that in an easy way using hashing and let me know if you have any doubt

Printed the length of ‘str’ to check if it is picking only the desired string or something extra but it seems to get the correct string.Can you please elaborate what you meant.

I am not familiar with c++ STL. Just curious to know for what input does my code gives Wrong Answer.I Will definitely try different approach to solve this question.