백준 3986번 좋은단어 (C++)(부제 맞왜틀..)


백준  3986번 좋은단어 (C++)(부제 맞왜틀..)

문제정답 코드#include #include #include #include using namespace std; stack a; int check(string s) { if (s.size()%2 != 0) return (0); for (auto it : s) { if (a.empty()) a.push(it); else if (a.top() == it) a.pop(); else a.push(it); } char c1,c2; while (!a.empty()) { c1 = a.top(); a.pop(); if (a.empty()) return (0); c2 = a.top(); a.pop(); if (c1 != c2) { while (!a.empty()) { a.pop(); } return (0); } } r..


원문링크 : 백준 3986번 좋은단어 (C++)(부제 맞왜틀..)