Answered step by step
Verified Expert Solution
Link Copied!

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 image text in transcribed

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 below

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students also viewed these Databases questions