Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <stack>
- using std::ifstream;
- using std::ofstream;
- using std::stack;
- using std::max;
- stack <bool> S;
- int main (void) {
- ifstream fin ("paranteze2.in");
- ofstream fout ("paranteze2.out");
- char x;
- int _max=0;
- while (fin >> x)
- if (x=='(') {
- S.push(1);
- _max=max(_max, (int)S.size());
- }
- else
- S.pop();
- fout << _max;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement