SHARE
TWEET

Untitled

a guest Mar 26th, 2020 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. long long n,i,l,r,b,c,p,x,j,k;
  6. string s,ss;
  7. int main()
  8. {
  9.  
  10.  
  11.  cin >> s;
  12.  n = s.length();
  13.  c = 0;k = 0;
  14.  for(i = 0;i<n;i++){
  15.    if(s[i]=='(') c++;
  16.    if(s[i]==')') c--;
  17.     if(c==-1) k=1;
  18.   }
  19.    if(k == 1) cout << "NO";
  20.    if(k == 0) cout << "YES";
  21. return 0;
  22. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top