My Code is showing the correct output and I have considered the constraints, still my answer is Wrong. I am new here. Are there any limitations to the answers that we submit?

Problem Link:

My Solution Link:
https://www.codechef.com/viewsolution/32858186

Your output is not correct.
For this sample input

1
4
hasan jaddouh
farhod khakimiyon
kerim kochekov
hasan khateeb

Your code is outputting following:

hasan
farhod khakimiyon
kerim kochekov
hasan

Moreover you don’t need to check if the number of testcases or any other input value is in constraint or not.
if n >= 2 and n <= 100:
if t >=1 and t <= 100: not required

1 Like

Thank you Anshul for your response.
I was able to get it right after some changes.
https://www.codechef.com/viewsolution/32875501

1 Like