Gives correct answer for ustom input but shows wrong answer on submission


this is my code. I am unable to figure out the error

@tanjuljain19 your compare function was wrong. i have corrected it please take a look at it

But strings can be compared lexicographically ,so why do we need to concatenate and compare them

we are still comparing them but after appending because a > b doesnt guarantee that a+b is the better choice for example if a = 101 and b = 48, then a+b= 10148 and b+a = 48101, we can see that relationship between a and b is meaningless what matters is a+b and b+a.