MicrosoftOA #70
Valid Mixed Case Letters
估计简单可在线判题
考点(AI 标注)哈希计数
Count the distinct English letters that appear in both lowercase and uppercase, where every lowercase occurrence of the letter comes before every uppercase occurrence. Count by letter only.
This site uses a standard input/output protocol.
输入格式
One line containing a string of English letters of length 1..100000, consisting only of a-z and A-Z.
输出格式
Output a single integer, the answer.
样例 1
输入:
aaAbBcC
输出:
3
样例 2
输入:
aAaB
输出:
0
样例 3
输入:
ABC
输出:
0
样例说明
Example 1: the lowercase a, b, and c all appear first, so 3 letters count. Example 2: a appears in lowercase again after A, so it does not qualify; b has no lowercase form, for a total of 0. Example 3: every letter appears only in uppercase, so 0.