3121. Count the Number of Special Characters II
3121. Count the Number of Special Characters II
Description
You are given a string word. A letterc is called special if it appears both in lowercase and uppercase in word, and every lowercase occurrence of c appears before the first uppercase occurrence of c.
Return the number of special letters in word.
Example 1:
1 | Input: word = "aaAbcBC" |
Example 2:
1 | Input: word = "abc" |
Example 3:
1 | Input: word = "AbBCab" |
Constraints:
1 <= word.length <= 2 * 10^5wordconsists of only lowercase and uppercase English letters.
Hints/Notes
- N/A
Solution
Language: C++
1 | class Solution { |