You are on page 1of 1

String Practice Sheet

Program 1: Print complete lastname and remaining words of the name as initial
I/P: First Second Lastname
O/P: F.S.Lastname

Program 2: Print the words which has the maximum or minimum length
I/P: This is a test String
O/P: Smallest: a
Largest: String

Program 3: Print repetitive character occurrence.


I/P: Rabbit has a good habbbit to rrrrrunnnnnnn faaaaaaaaast
O/P: bb, oo, bbb, rrrrr, nnnnnnn, aaaaaaaaa

Program 4: Print the string in reverse order of words


I/P: This is a test String
O/P: String test a is This

Program 5: Print the string as each word of the string has its first character in uppercase.
I/P: STRING can bE iNSERted in anY CASE
O/P: String Can Be Inserted In Any Case

Program 6: Remove the contact numbers from a string


I/P: contact 1 is 9874563217 and contact 2 is 91-8452136975 and contact 3 is +91-9784563214
O/P: contact 1 is and contact 2 is and contact 3 is

Program 7: Remove duplicate words from string


I/P: This is a test test string string for example example example
O/P: This is a test string for example

Program 8: Check the string for palindrome, if it is not make it a pallindrome


I/P: MADAM
O/P: Yes, IT IS A PALLINDROME
I/P: MAD
O/P: No, IT IS NOT A PALLINDROME –MAKE IT AS : MADDAM

Program 9: Print all the possible words for a given string


I/P: CAT
O/P: CAT, ATC, CTA, TAC, TCA, ACT

You might also like