Problems
Bracket sequence
and what's the inputs in 14th and 28th tests
#16390704 //with stack
include <iostream>
include <stack>
using namespace std; int main() { stack<char> st; bool yoxla = false; string moterize; cin>>moterize; for(int i = 0; i < moterize.length(); i++) { if(moterize[i] == '(')st.push('('); else if(moterize[i]==')') { if(st.empty()) { yoxla = true; break; } st.pop(); } } if(!yoxla && st.empty()) cout << "YES\n"; else cout <<"NO\n"; return 0; }