fork download
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner in = new Scanner(System.in);
        int space = 0, vowel = 0, chara = 0, i;
        System.out.println(" Enter String ");
        String s = in.nextLine();
        for (i = 0; i < s.length(); i++) {
            //char ch = in.next().charAt(i);
            if (s.charAt(i) == ' ') {
                space++;
            }
            if (s.charAt(i) == 'a' || s.charAt(i) == 'e' || s.charAt(i) == 'i' || s.charAt(i) == 'o' || s.charAt(i) == 'u') {
                vowel++;
            } else {
                chara++;
            }
        }
        System.out.println("Number of Vowels = " + vowel);
        System.out.println("Number of Spaces = " + space);
        System.out.println("Number of Char   = " + chara);
	}
}
Success #stdin #stdout 0.1s 2184192KB
stdin
my sentence goes here
stdout
 Enter String 
Number of Vowels = 7
Number of Spaces = 3
Number of Char   = 14