Delete as few characters as possible from s so that every remaining a comes before every remaining b. Either letter may be absent from the result. Return the minimum number of deletions; the relative order of characters you keep cannot change.
Example 1:
Input: s = "a"
Output: 0Explanation: A string containing only "a" is already balanced.
Example 2:
Input: s = "b"
Output: 0Explanation: A string containing only "b" is already balanced.
Example 3:
Input: s = "ba"
Output: 1Explanation: The "b" occurs before an "a", so one deletion is necessary. Removing either character leaves a balanced string.
Constraints:
1 <= s.length <= 100000- Each character is
aorb.