Minimum Length After Removing AB and BB

Given a string seq consisting only of 'A' and 'B', you may repeatedly perform either of the following operations:

  • Delete any contiguous occurrence of "AB".
  • Delete any contiguous occurrenc...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: