Saturday, 1 December 2012

Dispay of each word with the no. of vowels in it


import java.io.*;
class Word2
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int i,c=0,l;
String s,k="";
System.out.println("Enter the string");
s=br.readLine();
s=s+" ";
l=s.length();
for(i=0;i<l;i++)
{
if(s.charAt(i)!=' ')
{
k=k+s.charAt(i);
}
else
{
for(int j=0;j<k.length();j++)
{
if((k.charAt(j)=='A')||(k.charAt(j)=='a')||(k.charAt(j)=='E')||(k.charAt(j)=='e')||(k.charAt(j)=='I')||(k.charAt(j)=='i')||(k.charAt(j)=='O')||(k.charAt(j)=='o')||(k.charAt(j)=='U')||(k.charAt(j)=='u'))
{
c++;
}
}
System.out.println(k+"\t\t\t\t\t\t\t"+c);
c=0;
k="";
}
}
}
}

No comments:

Post a Comment