Company: JPMC_28june
Difficulty: medium
Remove AWS Occurrences Problem Description You are given a string s made up of uppercase English letters. As long as the string contains the substring "AWS" , remove the leftmost occurrence of "AWS" and join the part before it to the part after it. Repeat this until the string contains no occurrence of "AWS" . Print the string that remains. If nothing remains, print -1 instead. Complete the function getFinalString in the editor below. getFinalString has the following parameter: string s : a string of uppercase English letters Returns string : the string left after all occurrences of "AWS" have been removed, or "-1" if the string left is empty Input Format A single line containing the string s . Output Format Print a single line containing the remaining string, or -1 if the remaining string is empty. Print the value on its own, without quotation marks. Examples Example 1 Input AWAWSSG Output G Explanation The leftmost "AWS" in AWAWSSG is at positions 3-5 (1-based). Removing it leaves AW