Problem · String

Uppercase-Lowercase Difference

Learn this problem
EasyTiktok logoTiktokINTERNOA
See Tiktok hiring insights

Problem statement

In a typing-practice application, user input is represented by a string typedText containing uppercase and lowercase English letters.

Return the number of uppercase letters minus the number of lowercase letters in typedText.

Function

solution(typedText: String) → int

Examples

Example 1

typedText = "CodeSignal"return = -6

There are 2 uppercase letters (C and S) and 8 lowercase letters, so the result is 2 - 8 = -6.

Example 2

typedText = "a"return = -1

There are no uppercase letters and one lowercase letter, so the result is 0 - 1 = -1.

Constraints

  • typedText contains only uppercase and lowercase English letters.

More Tiktok problems

drafts saved locally
public int solution(String typedText) {
    // Write your code here.
}
typedText"CodeSignal"
expected-6
checking account