#include <iostream>
#include<string>
#include<stack>
using namespace std;
int solution(string s)
{
int answer = -1;
stack<char> st;
for(int i=0; i<s.length(); i++){
if(st.empty()) st.push(s[i]);
else{
char ret = st.top();
if(ret == s[i]){
st.pop();
}
else st.push(s[i]);
}
}
if(st.empty()) answer = 1;
else answer = 0;
return answer;
}
전형적인 스택문제이다. 어떻게 푸는지만 알아두자.