warriorscats

paranteze2

Jul 22nd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include<fstream>
  2. using namespace std;
  3. ifstream cin("paranteze2.in");
  4. ofstream cout("paranteze2.out");
  5. int main()
  6. {
  7. char sir[255],*p;
  8. int k=0,max=0;
  9. cin>>sir;
  10. for(p=sir;*p;p++)
  11. {
  12. if(*p=='(')
  13. {
  14. k++;
  15. if(k>max)
  16. max=k;
  17. }
  18. else
  19. k--;
  20. }
  21. cout<<max;
  22. }
Add Comment
Please, Sign In to add comment