Chap-5 String Programs
Chap-5 String Programs
1. Write a program to print every character of a string entered by user in a new line using loop.
2. Write a program to find the length of the string "refrigerator" without using len function.
3. Write a program to check if the letter 'e' is present in the word 'Umbrella'.
4. Write a program to check if the word 'orange' is present in the "This is orange juice".
5. Write a program to find the first and the last occurrence of the letter 'o' and character ',' in "Hello,
World".
6. Write the string after the first occurrence of ',' and the string after the last occurrence of ',' in the
string "Hello, Good, Morning". World".
7. Write a program that takes your full name as input and displays the abbreviations of the first and
middle names except the last name which is displayed as it is. For example, if your name is Robert
Brett Roser, then the output should be R.B.Roser.
8. Check the occurrence of the letter 'e' and the word 'is' in the sentence "This is umbrella".
9. Write a program to find the number of vowels, consonants, digits and white space characters in a
string.
10. Write a program to make a new string with all the consonants deleted from the string "Hello,
have a good day".
11. Write a program to find out the largest and smallest word in the string "This is an umbrella".
12. Write a program to check if a given string is a Palindrome.A palindrome reads same from front
and back e.g.- aba, ccaacc, mom, etc.
13. Write down the names of 10 of your friends in a list and then sort those in alphabetically
ascending order.
14. Write a program to make a new string with the word "the" deleted in the sentence "This is the
lion in the cage".
15.Write a program to check if the two strings entered by user are anagrams or not. Two words are
said to be anagrams if the letters of one word can be rearranged to form the other word. For
example, jaxa and ajax are anagrams of each other.