Computer Science, asked by trashikagoyal, 10 months ago

10. A String is said to be valid if it contains a pair of parenthesis having text/alphabets enclosed such as (TY) and the String is said to be invalid if it contains nested parenthesis such as (Y(UP)). e.g.: “SUN (A(X) RISE) BEGINS FROM (RT) EAST” is an ‘Invalid’ string because in this string nested parenthesis are present, but “SUN (A) RISE BEGINS FROM (RT) EAST” is a ‘Valid’ string because there is no nested parenthesis. Write a program to read a Sentence and convert it is in capitals. Check the validity of Sentence. If the String is valid, then display the given String omitting the portion enclosed in parenthesis otherwise, display a message “Sorry, an invalid String”. ​

Answers

Answered by Anonymous
0

Answer:

Given, ACNE is coded as 3-7-29-11. Here, each letter is coded as 2 face value of the alphabet +1. Similarly, BOIL will be coded as 5-31-19-25.

Similar questions