Case Separation
You are given a string s containing: uppercase + lowercase English letters
Your task is to Convert the string into a string such that all uppercase letters come first, then all lowercase letters.
You can change case of any character (1 operation per change)
Your task is to find the minimum amount of operations needed.
Example 1:
Input: s = "abBAc"
Output: 2
Explanation: Best split: [abBA] [c] (one of the many possible)
Convert:
- a → A
- b → B
Total = 2 changes.
Example 2:
Input: s = "AAAA"
Output: 0
Explanation : Already valid (all uppercase).
Now Your Turn!
Pick the correct output for the given inputInput: s = "aAaAaA"
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= |S| <= 105
- S consists only of uppercase and lowercase English letters.