Answer:
import java.util.Scanner;
public class ANot {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Please enter a string of words");
String n = in.nextLine();
int count = 0;
for (int i=0; i<n.length(); i++){
if((n.charAt(i) != '.') &&(n.charAt(i) != ',') && (n.charAt(i) != ' ')){
count++;
}
}
System.out.println(count);
}
}
Explanation: