Problem in CB numbers Code

Can you please tell me problem in my code.It is working for more than half the number of test cases.
Please refer to link

@parmara8182 You have to maximize the answer. So try generating all the. Substrings and see which permutation gives you the maximum result.