Copy and paste your answer to the assignment on Upgraded Balanced Parentheses at the IDE found at the left.
#include <iostream>
#include <string>
#include <vector>
#include <stack>
using namespace std;
int main()
{
string x;
stack < char, vector<char> > iStack;
cout << "Enter series of parentheses: ";
getline(cin, x);
for (int i=0; i<x.length(); i++)
if (x[i] == '(' || x[i] == '{' || x[i] == '[')
iStack.push(x[i]);
else
{
cout << iStack.top() << endl;
iStack.pop();
}
if (iStack.empty())
cout << "Balance!" << endl;
else
cout << "Not Balance!" << endl;
}