Please either format your code or (better!) link to your submission - the forum software has mangled it and it won’t compile!
Also - please link to the actual Problem - which Problem is the “Third Problem” depends on how they are sorted.
Now can you help?
and suggest where im wrong in my code
Still getting wrong answer
my code gives right answer on the above test case but still i got WA . can you suggest where i am wrong
No, your code doesn’t work on this test. It prints NO. When the answer is YES.
baabaa -> ababaa -> abaaba.
In question it is written that “neither of these elements may be used in any other operation” . Is it referring to used indexes or letters of string?
Indexes. Neither of the indexes shall be used in any other operations.
Your code’s output : NO
both the above test cases passes on this code and still get WA