Computer Science, asked by trashikagoyal, 7 months ago

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:

to combine two expressions or more, put every expression in brackets, and use: *?

...

This are the signs to combine, in order of relevance:

? exemple (A)?(B)

| exemple A|B.

()() exemple (A)(B)

()|() exemple (A)|(B)

Similar questions