← 返回 meta 的题目列表Calculate the difference between uppercase and lowercase letters
类型:online_judge
Given a string typedText that includes uppercase and lowercase English letters, compute the difference between the number of uppercase and lowercase letters in this string. Return the difference as an integer.
Note:
Expected time complexity is O(typedText.length).
Example
For typedText = "CodeSignal", the output should be solution(typedText) = -6.
For typedText = "a", the output should be solution(typedText) = -1.
For typedText = "AbCdEf", the output should be solution(typedText) = 0.
Input/Output
Execution time limit: 4 seconds (py3)
Memory limit: 1 GB
Example
Input
CodeSignal
Output
-6