CPP String Assignment
CPP String Assignment
12. Write a C++ program to change the case (lower to upper and
upper to lower cases) of each character of a given string.
13. Write a C++ program to find the numbers in a given string and
calculate the sum of all numbers. Example:
Sample Input: w3resource from 2008
Sample Output: Sum of the numbers: 2011
15. Write a C++ program to find the longest common prefix from
a given array of strings.
Example:
n=2
[[]] [][]
n=3
[[]] [][] [[[]]] [[][]] [[]][] [][[]] [][][]
Example:
Original Parentheses string: [[]
Length of longest parentheses: 2
Original Parentheses string: [[]]]
Length of longest parentheses: 4
Original Parentheses string: ]]]][[[[
Length of longest parentheses: 0
Example:
Original string: abcd $ js# @acde$
New string after removing the special characters from the said
string:
abcd js acde
Example:
Original String:
Total number of unique characters of the said two strings.
Number of duplicate characters in the said string: 36
Example:
Original String:
The Quick Brown Fox.
Check the said string is a title cased string or not!
True
28. Write a C++ program that takes a string and reverses the
words of three or more lengths in a string. Return the new string.
As input characters, only spaces and letters are permitted
Example:
Original string: The quick brown fox jumps over the lazy dog
Reverse the words of three or more lengths of the said string:
ehT kciuq nworb xof spmuj revo eht yzal god