Files

26 lines
642 B
Java
Raw Permalink Normal View History

2017-03-05 00:26:42 -06:00
// Author: Rodney Shaghoulian
2018-07-27 16:45:56 -07:00
// Github: github.com/RodneyShag
// HackerRank: hackerrank.com/RodneyShag
2017-03-05 00:26:42 -06:00
import java.util.Scanner;
public class Solution {
2017-09-11 09:32:17 -07:00
public static void main(String[] args) {
2017-03-05 00:26:42 -06:00
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;
}
}