Could use the following code:

import java.io.*;

public class Countstringword s {

private static BufferedReader stdin = new BufferedReader( new InputStreamRead er( System.in ));

public static void main(String arg[]) throws IOException {
System.out.prin tln("Enter a string: ");
String input = stdin.readLine( );
int i,l = 0;
String[] arr = input.split("...