Check (JAVA PROGRAM PDF)
Check (JAVA PROGRAM PDF)
1/1
import java.io.*;
/**
* PROGRAM TO FIND NUMBER OF WORDS BEGINING WITH A CAPITAL VOWEL
*/
public class Check
{
String Str;
int w;
DataInputStream d=new DataInputStream(System.in);
void InputString() throws IOException
{
System.out.println("ENTER STRING");
Str=" "+(d.readLine()).trim()+" 0";
}
void Counter(int n)
{
if(n>-1)
{
if(Str.charAt(n)==' ')
{
if(Str.charAt(n+1)=='A'||Str.charAt(n+1)=='E'||Str.charAt(n+1)
=='I'
||Str.charAt(n+1)=='O'||Str.charAt(n+1)=='U')
{
w++;
}
}
Counter(n-1);
}
}
void Disp()
{
Counter((Str.length()-1));
System.out.println("NO OF CAPITAL VOWELS IS "+w);
}
void main() throws IOException
{
Check ob1=new Check();
ob1.InputString();
ob1.Disp();
}
}
check1.main();
ENTER STRING
I am not An Atheletic person
NO OF CAPITAL VOWELS IS 3
check1.main();
ENTER STRING
I went to visit An old Friend at Allahabad yesterday
NO OF CAPITAL VOWELS IS 3