Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String str = sc.nextLine();
- sc.close();
- byte i = 0, count = 0;
- while(i < str.length() && str.charAt(i) != '.'){
- if(str.charAt(i) == ' ')
- count++;
- i++;
- }
- System.out.println(count);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement