Eliminate Substring

Eliminate Substring is a Jpmorgan coding interview question. Given an uppercase string s, repeatedly remove every occurrence of AWS, concatenating the remaining parts after each removal until none remain. Return the final string, or -1 if it becomes empty. Constraints: 1 ≤ |s| ≤ 1e5. A clear string manipulation problem for interviews.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: