Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <stack>
- #include <cstring>
- using namespace std;
- ifstream in("paranteze2.in");
- ofstream out("paranteze2.out");
- stack <char> s;
- char ss[270];
- int main()
- {
- int maxx=0;
- in.getline(ss,270);
- int k=0;
- for(int i=0; i<strlen(ss); i++)
- {
- if(ss[i]=='(')
- {
- s.push(ss[i]);
- if(maxx<s.size())
- {
- maxx=s.size();
- }
- }
- else
- {
- s.pop();
- }
- }
- out<<maxx;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement