8053794 | CodeChef

Hello. I’ve been trying this problem for over 30 minutes and I can’t seem to find the reason to why I’m not getting the right outputs. The first output, out of the 3 test cases, is correct, but the next two are incorrect. Can someone please explain to me why it is still not working? It would be much appreciated.

Here is my code:
T = int(input())
for i in range(T):
A = 0
B = 0
C = 0
A = input()
B = A.split(’ ')
C = sorted(B)

input() function returns string object(s). I think that is the problem with your code. Python sorts strings according to their ASCII codes.
In case you want to see my code for this problem: