Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stack>
- #include <string>
- using namespace std;
- int main()
- {
- string st;
- int i=0;
- cin>>st;
- while (true){
- i=0;
- while(st[i]!='\0'){
- if( st[i]=='[' && st[i+1]==']' ||st[i]=='(' && st[i+1]==')' || st[i]=='{' && st[i+1]=='}' ){
- st.erase(i,2);
- break;
- }
- i++;
- }
- if(st[i]=='\0'){
- if(st.size()==0)
- cout<<"YES";
- else {
- cout << "NO";
- }
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement