Trains the technique from
LeetCode 3120Count the Number of Special Characters IThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A plate reads word, a mix of lowercase and uppercase English letters.
A letter of the alphabet is stamped both ways when the plate holds it in lowercase somewhere and in uppercase somewhere. Return how many letters of the alphabet are stamped both ways.
Example 1
The letter k appears as both k and K, and the letter e appears as both e and E. The letters l, o, t, n, b and s appear in only one case each.
Example 2
All five letters turn up in both cases.
Example 3
Nothing on the plate is uppercase, so no letter is stamped both ways.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def number_of_special_chars(word: str) -> int:public int numberOfSpecialChars(String word)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.