Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class _05_CountAllWords {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- String sentence = sc.nextLine();
- System.out.println(sentence.split("\\W+").length);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement