Question
matches.txt 4 (a+[b*c]-{d/3}) (a + [b * c) - 17] (((a * x) + [b] * y) + c auf(zlo)men [gy ] four{s} matches2.txt 16
matches.txt
4
(a+[b*c]-{d/3})
(a + [b * c) - 17]
(((a * x) + [b] * y) + c
auf(zlo)men [gy
matches2.txt
16
[{c{y{+}}}{{z}g}*][u(-)]( )[(b)]{ }
[{v(b)}e]{(^)b{{
(/)[ ]{{d}c}(x)
((t](%)[w[h]]^e>)(z)
{
[^]
{}[ ]{( )[-][{ }u][h]t}{-(w)}( (y[z]))
{z}{f}{[ (*)(f)]/([c]/)}[)t)(v(]
(h){v}[v]
({a}{*}([a]w{{*}[a](-)( )>y(
{g}{+}
[u][((/)[
[((a)^)]([x][b][y] )([ ]{f [f]g)[%]
{t{d}}((a)v)a>{g[w]
>(%){-}{^}>( )
extra.txt
AZ()oO
2
A xxx o xxx ( xxx ) A ... Z O xxx Z
xxx A Z ( ( o O ) A Z
Matching Brackets Problem Description: We are given strings containing brackets of 4 types: round (, square [I, curly and angle . The goal of the program is to read a sequence of strings and to determine whether brackets are in correct sequence for each input string. To be in a correct sequence, any opening bracket should have closing bracket of the same type somewhere further by the string and bracket pairs should not overlap. Brackets can be nested. Some examples follow: (at[b cld/31) This is a valid string. The square and curly brackets are nested properly inside the round ones. (at[b c)171 This is not valid. The square brackets overlap with round ones. Your program is to read a number of lines from standard input (not a file). The first line will contain the number of testcases. Each line after will contain one string of characters. You are to print a 1 if the string is valid, a O if not. See the example outputs below. Notes: Turn in only your completed matcher.cpp file Two sample data files can be found on canvas: matches.txt and matches2.txt. You can run your program like this (assuming your executable is called matcher) ./matcherStep 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