-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCamelCaseHR.java
More file actions
24 lines (19 loc) · 778 Bytes
/
Copy pathCamelCaseHR.java
File metadata and controls
24 lines (19 loc) · 778 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
//Alice wrote a sequence of words in CamelCase as a string of letters,s, having the following properties:
//It is a concatenation of one or more words consisting of English letters.All letters in the first word are lowercase.
//For each of the subsequent words, the first letter is uppercase and rest of the letters are lowercase.
//Given , print the number of words in s on a new line.
import java.util.Scanner;
public class CamelCaseHR {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner(System.in);
int count = 1;
String s = in.next();
for(int i=0;i<s.length();i++){
if(Character.isUpperCase(s.charAt(i))){
count++;
}
}
System.out.println(count);
}
}