Class Solution
-
- All Implemented Interfaces:
public final class Solution3120 - Count the Number of Special Characters I\.
Easy
You are given a string
word. A letter is called special if it appears both in lowercase and uppercase inword.Return the number of special letters in
word.Example 1:
Input: word = "aaAbcBC"
Output: 3
Explanation:
The special characters in
wordare'a','b', and'c'.Example 2:
Input: word = "abc"
Output: 0
Explanation:
No character in
wordappears in uppercase.Example 3:
Input: word = "abBCab"
Output: 1
Explanation:
The only special character in
wordis'b'.Constraints:
1 <= word.length <= 50wordconsists of only lowercase and uppercase English letters.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final IntegernumberOfSpecialChars(String word)-
-
Method Detail
-
numberOfSpecialChars
final Integer numberOfSpecialChars(String word)
-
-
-
-