Isc Computer Programs
Isc Computer Programs
*;
class ISC_2015_3
{
public static void main(String args[])throws IOException
{
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in)
);
ISC_2015_3 obj=new ISC_2015_3();
int ct=0;
String s="";
int l=0;
while(ct!=1)
{
System.out.println("Enter a sentence");
s=stdin.readLine();
s=s.trim();
l=s.length();
if(s.charAt(l-1)=='.'||s.charAt(l-1)=='?')
ct++;
}
String s1="";
s=" "+s;
char ab;
char cd;
for(int i=0;i<l;i++)
{
ab=s.charAt(i);
cd=s.charAt(i+1);
if((ab==32)&&(cd>=97&&cd<=122))
{
s1=s1+" "+((char)(cd-32));
i++;
}
else
s1=s1+ab;
}
s1=s1.trim();
System.out.println(s1);
String s2="";
int c=0,d=0;
System.out.println("Word\t\t Vowels Consonants");
for(int i=0;i<s1.length();i++)
{
ab=s1.charAt(i);
if(ab!=32)
{
if(obj.vowels(ab))
c=c+1;
else
d=1+d;
s2=s2+ab;
}
else
{
System.out.println(s2+"\t\t"+c+"\t"+d);
s2="";
c=0;
d=0;
}
}
}
boolean vowels(char ab)
{
if(ab=='A'||ab=='a'||ab=='E'||ab=='e'||ab=='I'||ab=='i'||ab=='o'||ab=='O
'||ab=='u'||ab=='U')
return true;
else
return false;
}
}