Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of Special Characters II

Try to solve the Count the Number of Special Characters II problem.

Statement

You are given a string word. A letter c is called a special character if both its lowercase and uppercase forms appear in word, and every lowercase occurrence of c appears strictly before the first uppercase occurrence of c.

Return the total number of special characters in word.

Constraints:

  • 1≤1 \leq word.length ≤2imes105\leq 2 imes 10^5

  • word consists of only lowercase and uppercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count the Number of Special Characters II

Try to solve the Count the Number of Special Characters II problem.

Statement

You are given a string word. A letter c is called a special character if both its lowercase and uppercase forms appear in word, and every lowercase occurrence of c appears strictly before the first uppercase occurrence of c.

Return the total number of special characters in word.

Constraints:

  • 1≤1 \leq word.length ≤2imes105\leq 2 imes 10^5

  • word consists of only lowercase and uppercase English letters.