Output is right but all test cases failing

instead of comparing s1 with s2, you need to compare s1+s2, with s2+s1 because the number formed would either contain s1+s2 or s2+s1.
Corrected Code

i have tested on various inputs the result is same

1
2
781 78
answer should be 78781, but your code would give 78178

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.