Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What would be the easiest way to code this? Maybe give an example code as well? IN C++ PLEASE 1. As a programmer one must
What would be the easiest way to code this? Maybe give an example code as well? IN C++ PLEASE
1. As a programmer one must know whether sequences of parentheses are properly ordered. For example, one knows that " (())() " is properly ordered; however, ")()(" is not. But what if instead of parentheses, we use letters. If we have letters, then one needs to know what characters match one another. For this problem it's just going to be the character on the opposite half of the alphabet. For example, A and Z match, B and Y match, C and X match, and so on, until you see that M and N match. Furthermore, they can match forward and backward. This means that "AZ" and "ZA" are properly ordered sequences of letters. And for a more complicated example, "ZNMA" would also match. Write a program to check to see if letters match based on the algorithm mentioned above. Input from the keyboard a string of uppercase letters. Output to the screen "YES" if the string of letters is properly ordered; otherwise print "NO". The program must use a stack data structure. Finally, the program should ask if the user wants to run the program again (Check case). Refer to the sample output belowStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started