Words that start and end with a vowel program: ISC 2016 program
Write a program to accept a sentence which may be terminated by either’.’, ‘?’or’!’ only. The words may be separated by more than one blank space and are in UPPER CASE.
Watch java videos
words that start and end with a vowel program.
Write a program to accept a sentence which may be terminated by either’.’, ‘?’or’!’ only. The words may be separated by more than one blank space and are in UPPER CASE.
Perform the following tasks:
(a) Find the number of words beginning and ending with a vowel.
(b) Place the words which begin and end with a vowel at the beginning, followed by the remaining words as they occur in the sentence.
Test your program for words that start and end with a vowel with the sample data and some random data:
words that start and end with a vowel
Example 1
INPUT: ANAMIKA AND SUSAN ARE NEVER GOING TO QUARREL ANYMORE.
OUTPUT: NUMBER OF WORDS BEGINNING AND ENDING WITH A VOWEL= 3
ANAMIKA ARE ANYMORE AND SUSAN NEVER GOING TO QUARREL
Example 2
INPUT: YOU MUST AIM TO BE A BETTER PERSON TOMORROW THAN YOU ARE TODAY.
OUTPUT: NUMBER OF WORDS BEGINNING AND ENDING WITH A VOWEL= 2
A ARE YOU MUST AIM TO BE BETTER PERSON TOMORROW THAN YOU TODAY
Example 3
INPUT: LOOK BEFORE YOU LEAP.
OUTPUT: NUMBER OF WORDS BEGINNING AND ENDING WITH A OWEL= 0
LOOK BEFORE YOU LEAP
Example 4
INPUT: HOW ARE YOU@
OUTPUT: INVALID INPUT
import java.util.*;
public class StartEndVowel
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the String");
String str=sc.nextLine().toUpperCase();//taking input and converting to Uppercase
int len=str.length();
char ch=str.charAt(len-1);//last character in the string
if(ch=='.'||ch=='!'||ch=='?')//checking if the string ends with valid symbols
{
str=str.substring(0,len-1);//removing the full stop or exclamation mark
String arr[]=str.split(" ");
String vowel="";//for the words that start and end with vowels
String notvowel="";//for other words
int count=0;//to count the number of words that start and end with vowels
for(int i=0;i<arr.length;i++)
{
String temp=arr[i];
int l=temp.length();
char start=temp.charAt(0);
char end=temp.charAt(l-1);
if(start=='A'||start=='E'||start=='I'||start=='O'||start=='U')//checking
{
if(end=='A'||end=='E'||end=='I'||end=='O'||end=='U')
{
vowel+=temp+" ";
count++;
}
else
notvowel+=temp+" ";//here the word does not end with vowel
}
else
notvowel+=temp+" ";//neither starts nor ends with vowels
}
String result=vowel+notvowel;//just concatenating both strings
System.out.println("Words starting and ending with vowels are "+count);
System.out.println(result);
}
else
System.out.println("INVALID INPUT");
}
}
Download free Sample papers
Related Posts
Continue learning with these related articles

Logic Gates for ISC Class 11: Truth Tables, Universal Gates, Half and Full Adder
ISC Class 11 Computer Science notes on logic gates: AND, OR, NOT, NAND, NOR, XOR and XNOR with truth tables, why NAND and NOR are universal gates, and half adder and full adder circuits with their Boolean expressions.
Decimal to Binary Conversion in Java: 3 Programs with Examples
How to convert a decimal number to binary on paper and in Java: three programs (String, place value and Integer.toBinaryString), binary to decimal, a dry run and common mistakes.

ISC Class 11 Computer Science Sample Paper 2026-27 with Solutions
A full 70-mark ISC Class 11 Computer Science sample paper for the 2026-27 annual exam: MCQs, number systems, propositional logic, logic gates, Java classes, arrays, strings, searching and sorting, and computing ethics, with complete worked solutions.