Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

image text in transcribed

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

[{c{y{+}}}{{z}g}*][u(-)]( )[(b)]{ }

[{v(b)}e]{(^)b{{-}z[[e]y[h]][%]{ (c)}}}[ ]>{e}

(/)[ ]{{d}c}(x))>>[b[v]]

((t](%)[w[h]]^e>)(z){g>}

{ }>][{ }{a}/{ }(g)]-([z]b)>

[^]

{}[ ]{( )[-][{ }u][h]t}{-(w)}( (y[z]))

{[[z]+]{/[ ]}[c]})e)>][+]e>

{z}{f}{[ (*)(f)]/([c]/)}[)t)(v(]

(h){v}[v]

({a}{*}([a]w{{*}[a](-)( )>y(d[w](e))}))

{g}{+}]>{x})>[+][d}(d)[b]

[u][((/)[{u}*] ) [{c} [%]]](z){( ){u}}

[((a)^)]([x][b][y] )([ ]{f [f]g)[%]

{t{d}}((a)v)a>{g[w]}[{(b)z}][/]{z}

>(%){-}{^}>( )

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) ./matcher

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

Students also viewed these Databases questions

Question

=+1 Is the decision fair to employees?

Answered: 1 week ago