forked from RyanFehr/HackerRank
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
37 lines (30 loc) · 800 Bytes
/
Solution.java
File metadata and controls
37 lines (30 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//Problem: https://www.hackerrank.com/challenges/camelcase
//Java 8
/*
If we handle the edge cases all we need to do is count the capital letters
*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String s = in.next();
if(s.isEmpty())
{
System.out.println("0");
System.exit(0);
}
int words = 1;
for(char letter : s.toCharArray())
{
if(letter < 91 && letter > 64 )
{
words++;
}
}
System.out.println(words);
}
}