17 solutions
-
0
#include <iostream> #include <cstring> using namespace std; int main() { int count=0,su=0; char a[1001]; fgets(a,1001,stdin); for(int i=0;i<strlen(a);i++) { if(a[i]=='(') count++; if(a[i]==')') su++; if(count<su) { cout<<"NO"<<endl; return 0; } } if(count==su) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }
Information
- ID
- 289
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 5
- Tags
- # Submissions
- 234
- Accepted
- 87
- Uploaded By