Given a string A consisting of lowercase English alphabets. Reduce the string to its shortest length
by doing any number of operations (possibly zero).
In one operation selects a pair of adjacent letters in the string that match and deletes them.
For example the string bcaa is shortened to bc in one operation.
Find and return the string by reducing it to its shortest length. if the resultant string is empty return “empty”.
The only argument given the string A.
Return the string by reducing it to its shortest length. if the resultant string is empty return “empty”.
1 <= length of the string <= 1000000
Input 1: A = "aaabccddd" Output 1: "abd" Input 2: A = baab Output 2: "empty"
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.