View Code of Problem 58

import java.util.Scanner;
public class Main {
public static void main(String[] args) {
	Scanner scanner=new Scanner(System.in);
	String str[]=scanner.nextLine().split(" ");
	int len=str.length;
	int count=0;
	for(int i=0;i<len;i++){
		if(str[i].length()>0){
			count++;
		}
	}
	System.out.println(count);
}
}

/*
Main.cc:1:1: error: 'import' does not name a type; did you mean 'short'?
 import java.util.Scanner;
 ^~~~~~
 short
Main.cc:2:1: error: expected unqualified-id before 'public'
 public class Main {
 ^~~~~~
*/

Double click to view unformatted code.


Back to problem 58