Get Final String

Problem Overview

  • Remove all occurrences of the substring "AWS" from an uppercase string repeatedly until none remain, then return the final string.
  • Input: string s (length 1 to 100000, uppercase only). Output: the resulting string, or "-1" if it becomes empty.
  • Applies to string processing tasks such as text cleanup and parsing.
  • Asked in Ibm interviews; a classic coding interview problem and interview question.

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: