You are on page 1of 1

package BasicsExamples;

import java.util.Scanner;
public class Vowelsconsonents {

public static void main(String[] args) {


Scanner scanobj=new Scanner(System.in);
System.out.println("Enter the string");
String inputtext = scanobj.nextLine();
int ctr=1,vowels=0,whitespace=0,constant=0;
while(ctr < inputtext.length()){
switch(inputtext.charAt(ctr)){
case'a':
case'e':
case'i':
case'o':
case'u':
vowels++;
break;
default :
constant++;
break;

case' ':
whitespace++;
break;
}
ctr++;

System.out.println(vowels +" "+constant+" "+


(whitespace));

You might also like