Company: amdocs_31oct
Difficulty: medium
Lexicographically Smallest String from Operations Problem Description Bobby received a gift of a string s with a length of up to 105 characters for his birthday. He took two more empty strings, t and u , and decided to play a game. This game has two possible moves: Extract the first character of s and append t with this character. (This implies pushing to a stack t ). Extract the last character of s and append u with this character. Additionally, Bobby can, at any point, extract the top character from string t (if t is not empty) and append it to string u . Bobby wants to get strings s and t empty and string u lexicographically minimal. You should write a program to help Bobby win the game and return string u being lexicographically minimal. A string a is lexicographically smaller than string b (of the same length) if in the first position where a and b differ, string a has a letter that appears earlier in the alphabet than the corresponding letter in b . If the letters are equal, we c