String Sort Doubt

Here is the code:-https://ide.codingblocks.com/s/417728, please guide what wrong am i doing in the code either in method or implementation or whether the intution is wrong. First of all please clarify the mistake and also give me hint to do the question.

Hello @Sakshi2004 you are using the semicolon in line 9 after if condition remove that.

Ok yes, this is right. But the answer is not coming right.

okay wait checking your code again.

check this;

Please clarify this is also:- let s= “Geeks” and say s.substr(1,3), so whether it should give output as eek or ee ,that is, we should take substring from start position to last positon index -1 or til last position index. Because in geeksforgeeks it is given as the former one.

see in the substr(the first parameter should be the starting point and the second parameter should be the length if the string you want to print).
so if we take this example: let s= “Geeks” and say s.substr(1,3)
ouput should be: eek

and the code which in which i have made correction will not pass test cases until you will do the changes mentioned in this corrected code of yours:

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.