[go: up one dir, main page]

0% found this document useful (0 votes)
196 views4 pages

String

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 4

Strings:-

------------------------------------------------------------------------------------------

1) Write a program to find string length using pointer.

2) Write a one line code to copy the string into another buffer.
3) Write a program to find the no. of times the character is found in a
given string.

4) Write a program to find vowels in a given string.

5) Write a program to compare two strings without using strcmp function.

6) Write a program to reverse the string using loops & recursion.

7) Write a program to check the given strings are palindrome or not.


Note: Palindrome words are words which read and spell the same way
both backwards
and forwards. Some examples,
madam, level , radar, stats and etc.

8) Write a program to find the no. of words are presented in a given string
line.
Note: User has to input the string line at runtime.

9) Write a program to delete a desired character in a given string.


Ex: Input: embedded
Character: ’d’
Output: embee

10) Write a program to remove the conjucutive spaces in a given string


line.
Ex: Input: Vector India Pvt Ltd
Output: Vector India Pvt Ltd;

11) Write a program to delete the duplicate characters in a given string.


Ex: Input: vecteeovvorr
Output: vector

12) Write a program to print the count of duplicate characters in a given


string.
Ex: Input: “hrithik roshan”
Output: Letter ------- Count
h ------- 3
r ------- 2
I ------- 2
13) Write a program to find count of Lower characters, Upper characters,
Special characters and digits occurred in a given string.

14) Write a program to convert the characters Upper to Lower and Lower
to Upper in a given string.

15) Write a program to sort a given string in ascending order.

16) Write a program to accept two strings from user into two character
array and copy one by one character into another destination array.
Ex: First String: “abcdefg”
Second String: “1234”
Then Destination String is “a1b2c3d4efg”

17) Write a program to find the no. of times substring is found in a given
string.

18) Write a program to reverse the words in a given string line.


Ex: “I am a good boy”
“I ma a doog yob”

19) Write a program to replace the words in reverse order in a given string
line.
Ex: Input: “world changed your thoughts”
Output: “thoughts your changed world”

20) Write a program to read two strings through the keyboard like the
following example and replace any word of the second string with the first
string.
Ex: Input:- Fist String: “Tomorrow”
Second String: “Today is Sunday”
Replace word: “Today”.

Output:- “Tomorrow is Sunday”

21) Write a program to check given strings are anagram or not.


Note: Both strings are anagram, if both contains same elements, same
no. of times in any order.
(Can have extra special characters & digits also)

Ex: "Osama bin laden" , "Old man in a base" both are anagrams.
“study” , “dus%@ty123” both are anagrams.
Here after removing special characters and digits ---->
“ dusty “.

22) Write a program for Decryption of a given Encrypted string line with
respect to given key number.

The letter at position of the key and a multiple of key is interchanged with
the next letter. Spaces and special characters are to be ignored. If the letter
is the last one in the array, then no interchange is required.

Design a function called Decryptor to receive the Encrypted data from the
main function and decrypt the data.

4 8 12 16 20 24 28 32 36
Ex: Input String : “Expcet Porblmes adn eat thef mor rbeafkast”.
If Key : 4 then, 4 multiples ---> 4,8,12,16,20,24,28,32,36 these
letters has to interchange with next
Characters.
Output String : “Expect Problems and eat them for breakfast”.

Try this and Know it.

Input String : “Our rgeaetst ewakenss iles ni giivng pu. thm eosc teratin
awy ts ouceed si
alwyas tt ory ujst noe mroe tmie”.

Key : 4

Output : ????????

-------------------------------------- END --------------------------------------------

Dear students, If any mistakes found, kindly inform to me.

A. Tandava Ramakrishna.
Email: ramakrishna@vectorindia.org

You might also like