Advertisement
thewitchking

Untitled

Apr 7th, 2025
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 KB | None | 0 0
  1. public int solution(String typedText) {
  2.         int upperSum = 0;
  3.         int lowerSum = 0;
  4.  
  5.         for (char ch : typedText.toCharArray()) {
  6.             if (Character.isUpperCase(ch)) {
  7.                 upperSum ++;
  8.             } else if (Character.isLowerCase(ch)) {
  9.                 lowerSum ++;
  10.             }
  11.         }
  12.  
  13.         return upperSum - lowerSum;
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement