Walmart INTERN OA || HELP NEEDED

I am not getting any idea how to solve this question.
If anyone knows then please help me in solving these questions with code if possible.

Explanation:
In 1st operation: The first non-repeating character is a.
After Removing the first character, S = "bab".
After Reversing the string, S = "bab".
In 2nd operation: The first non-repeating character is b. 
After Removing the first character, S = "ab". 
After Reversing the string, S = "ba".
Now the string S does not contain any repeating character.

Constraints: 1<=length of s <=10^5

Check out my code .