import java.io.*;
public class Word_Vowel
{
boolean isVowel(char ch)
{
if(ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U'||ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
return true;
else
return false;
}
public void main()throws IOException
{
BufferedReader fl = new BufferedReader(new InputStreamReader(System.in));
String str;
char ch, ch2;
int i , l, c=0;
System.out.println("Enter a string:");
str = fl.readLine();
str = ' '+str;
l = str.length();
for(i=0;i<l;i++)
{
ch = str.charAt(i);
if(ch==' ')
{
ch2 = str.charAt(i+1);
if(isVowel(ch2))
c++;
}
}
System.out.println("Number of words that start with a vowel are: "+c);
}
}
Class 11: Write a program to input a string and print the number of words that start with a vowel.
Programming