0% found this document useful (0 votes)
8 views1 page

String AssignmentProgram5

Uploaded by

6725
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

String AssignmentProgram5

Uploaded by

6725
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Topic: String Practical Programming Assignment: 5

Write a program to accept a sentence which may be terminated by either ‘.’ or ‘?’ only. The words are to
be separated by a single blank space. Print an error message if the input does not terminate with ‘.’ or
‘?’. You can assume that no word in the sentence exceeds 15 characters, so that you get a proper
formatted output.

Perform the following tasks:


(i) Convert the first letter of each word to uppercase.
(ii) Find the number of vowels and consonants in each word and display them with proper headings
along with the words.

Test your program with the following inputs.

Example 1
INPUT: Intelligence plus character is education.
OUTPUT:
Intelligence Plus Character Is Education
Word Vowels Consonants
Intelligence 5 7
Plus 1 3
Character 3 6
Is 1 1
Education 5 4

Example 2
INPUT: God is great.
OUTPUT:
God is Great
Word Vowels Consonants
God 1 2
Is 1 1
Great 2 3

Example 3
INPUT: All the best!
OUTPUT:
Invalid Input.

You might also like