import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan=new Scanner(System.in); String str=scan.nextLine(); String[] str1=str.split("\\s+"); System.out.print(str1.length); } } |
Double click to view unformatted code.