ComputerApplications StringHandling Worksheet
ComputerApplications StringHandling Worksheet
1. Write a program to accept a sentence and word from the user. The program should count
and print the number of times the word appears in the sentence either as a separate word
or as a part of another word.
Example: INPUT – “the digit and the number is checked with another”
WORD TO CHECK – “the”
OUTPUT – frequency of the word the is = 3
2. Write a program to input a name. Print the given name and also the initials of that name
except the last name.
INPUT – "Mohan Das Karam Chand Gandhi“
OUTPUT – M.D.K.C. Gandhi
3. Write a program to accept a string. Convert the string to Uppercase. Count and output
the number of double letter sequences that exist in the string.
INPUT – “SHE WAS FEEDING THE LITTLE RABBIT WITH AN
APPLE”
OUTPUT – 4
4. Write a program to accept a word. Check and print whether the word is a Palindrome
word or Special word.
SPECIAL WORD – Those words which starts and ends with the same letter.Ex:
Existence, Comic.
PALINDROME WORD – Those words which read the same from left to right and vice
– versa. Ex: Malayalam, Level, Civic.
5. Write a program to input a string. Display the original string and the new string after
reversing each word at its own place.
INPUT – “This Is A Zoo”
OUTPUT – sihT sI A ooZ
6. Write a program to input a string and convert it into uppercase and print the frequency
of each character.
INPUT – Computer Hardware
OUTPUT –
Characters Frequency
A 2
C 1
D 1
E 2
H 1
M 1
O 1
P 1
R 3
T 1
U 1
W 1
7. WAP to input a sentence and print the total number of words, total number of spaces
and total number of alphabets.
8. WAP to input a name . convert its each letter to its opposite case. Print the original and
modified name along with suitable message.
Example: INPUT James Bond
OUTPUT Original name : James Bond
Modified name : jAMES bOND
10.WAP to input a Word and convert i tinto uppercase and print the Word by removing the
consecutive repeated characters from the Word and print the new Word generated.
Ex:INPUT:- “JAAAAAVVVVVVVAAAAA” OUTPUT:- JAVA
11.WAP to accept a Word and convert i tinto lowercase letters, and display the new Word
by replacing only the vowels with the characters following it. Ex: INPUT:
“program” OUTPUT: prpgrbm
12.WAP to input a sentence and display the number of vowels in each Word. Also derive
the Acronym of the sentence.
EX: INPUT: “UNFOLDING THE GOLDEN RATIO”
OUTPUT: UNFOLDING – 3, THE – 1, GOLDEN – 2, RATIO – 3, Acronym – UTGR
PARIVESH AGARWAL
(HOD – Comp Sc.)