Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<fstream>
- using namespace std;
- ifstream cin("paranteze2.in");
- ofstream cout("paranteze2.out");
- int main()
- {
- char sir[255],*p;
- int k=0,max=0;
- cin>>sir;
- for(p=sir;*p;p++)
- {
- if(*p=='(')
- {
- k++;
- if(k>max)
- max=k;
- }
- else
- k--;
- }
- cout<<max;
- }
Add Comment
Please, Sign In to add comment