Problem E: STL——括号匹配

#include  
#include 
using namespace std;
typedef stack STACK;
int main(){
	char c;
	string str; 
	while(cin >> str) {
	STACK st; 
	string::iterator s_it = str.begin();
	int flag =0; 
	while(s_it != str.end()) {
	  	if(*s_it == '(')
		   st.push(*s_it); 
		else { 
			if (!st.empty()) st.pop();
			else { 
				cout << "NO"<

 

你可能感兴趣的:(Problem E: STL——括号匹配)