🎧 Help Desk · Mission 6 of 6
🧮 Balanced Brackets
Students type formulas into the desk's calculator, and some forget a bracket. Check each formula: does every ( have its )?
Your mission
- Ask "Formula?" into text. Make open = [ ] and ok = true.
- Go through text letter by letter. At "(", Push it onto open. At ")": if open is empty, ok = false; otherwise Pop open.
- At the end, if ok && length(open) == 0, Tell "Balanced"; otherwise Tell "Not balanced".
Getting the mission ready…