26 lines
642 B
Java
26 lines
642 B
Java
// Author: Rodney Shaghoulian
|
|
// Github: github.com/RodneyShag
|
|
// HackerRank: hackerrank.com/RodneyShag
|
|
|
|
import java.util.Scanner;
|
|
|
|
public class Solution {
|
|
public static void main(String[] args) {
|
|
Scanner scan = new Scanner(System.in);
|
|
String str = scan.next();
|
|
scan.close();
|
|
System.out.println(numWords(str));
|
|
}
|
|
|
|
private static int numWords(String str) {
|
|
int count = 1;
|
|
for (int i = 0; i < str.length(); i++) {
|
|
char ch = str.charAt(i);
|
|
if (ch >= 'A' && ch <= 'Z') {
|
|
count++;
|
|
}
|
|
}
|
|
return count;
|
|
}
|
|
}
|