Given an expression string exp, write a program to examine whether the pairs and the orders of “{“, “}”, “(“, “)”, “[“, “]” are correct in exp. Example: Input: exp = “[()]{}{()()}” Output: Balanced Input: exp = “[(])” Output: Not Balanced
It was written a java application using the stack data structure in order to help with the identification of opening tokens "{", "(" and "[". From that, it was easy to determine which was the correct closing token.
- Make share you have installed at least jdk 8:
java -version
- Open the project in any IDE of your preference e execute the main method. The program will request a starting expression and will validate the input.