https://school.programmers.co.kr/learn/courses/30/lessons/12973

#include <iostream>
#include <string>
#include <stack>
using namespace std;

int solution(string s)
{
    stack <char> stk;
    int answer = -1;
    int len = s.size();
    
    stk.push(s[0]);
    
    for(int i = 1; i<len; i++){
        if(!stk.empty()&&stk.top() == s[i]){
            stk.pop();
        }
        else{
            stk.push(s[i]);
        }
    }
    
    if(stk.empty()){
        return 1;
    }
    else{
        return 0;
    }

    
    return 1;
}