We are given strings containing brackets of 4 types - round (), square [], curly {} and angle <> ones. The goal is to check, whether brackets are in correct sequence. I.e. any opening bracket should have closing bracket of the same type somewhere further by the string, and bracket pairs should not overlap, though they could be nested: {d/3}) here square and curly brackets are nested in the (a+[b*c] round ones -
We are given strings containing brackets of 4 types - round (), square [], curly {} and angle <> ones. The goal is to check, whether brackets are in correct sequence. I.e. any opening bracket should have closing bracket of the same type somewhere further by the string, and bracket pairs should not overlap, though they could be nested: {d/3}) here square and curly brackets are nested in the (a+[b*c] round ones -
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![Finally, complete the following programming task on https://play.kotlinlang.org and submit your
link to Blackboard. The input should be a string declared at the top of the file.
We are given strings containing brackets of 4 types - round (), square [], curly {} and
angle <> ones. The goal is to check, whether brackets are in correct sequence. I.e. any
opening bracket should have closing bracket of the same type somewhere further by the
string, and bracket pairs should not overlap, though they could be nested:
here square and curly brackets are nested in the
(a+[b*c] - {d/3})
round ones
(a+[b*c) 17]
does not make sense
Input data will contain a test-case in form of a character sequence.
Answer should contain 1 (if bracket order is correct) or 0 (if incorrect) for each of test-
cases, separated by spaces.
Example:
input data:
(a+[b*c]-{d/3})
*
here square brackets overlap with round ones which
(a + [b c)
(((a * x) + [b] y) + c
auf (zlo)men [gy<psy>] four {s}
answer:
1 0 0 1
17]
*](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fed90fcea-f380-4b95-9a74-5fa16bbec63f%2Ffd8bd892-a999-4455-81bc-ae122fc48ce6%2F0kf2bk_processed.png&w=3840&q=75)
Transcribed Image Text:Finally, complete the following programming task on https://play.kotlinlang.org and submit your
link to Blackboard. The input should be a string declared at the top of the file.
We are given strings containing brackets of 4 types - round (), square [], curly {} and
angle <> ones. The goal is to check, whether brackets are in correct sequence. I.e. any
opening bracket should have closing bracket of the same type somewhere further by the
string, and bracket pairs should not overlap, though they could be nested:
here square and curly brackets are nested in the
(a+[b*c] - {d/3})
round ones
(a+[b*c) 17]
does not make sense
Input data will contain a test-case in form of a character sequence.
Answer should contain 1 (if bracket order is correct) or 0 (if incorrect) for each of test-
cases, separated by spaces.
Example:
input data:
(a+[b*c]-{d/3})
*
here square brackets overlap with round ones which
(a + [b c)
(((a * x) + [b] y) + c
auf (zlo)men [gy<psy>] four {s}
answer:
1 0 0 1
17]
*
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 5 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY