#include <bits/stdc++.h>
using namespace std;
int ans;
void solve() {
string str;
cin >> str;
stack<char> st;
for (size_t i = 0; i < str.length(); ++i) {
if (!st.empty() && st.top() == str[i]) {
st.pop();
} else {
st.push(str[i]);
}
}
if (st.empty()) {
ans++;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
while (n--) {
solve();
}
cout << ans << '\n';
return 0;
}'PS' 카테고리의 다른 글
| 백준 BOJ 2468 C++ 안전영역 (0) | 2026.04.15 |
|---|---|
| 백준 BOJ 5014 C++ 스타트링크 (0) | 2026.04.15 |
| 백준 1021 C++ [boj 1021 회전하는 큐] (0) | 2026.04.15 |
| boj 17298 c++ [백준, 오큰수] (0) | 2026.04.14 |
| boj 6198 c++ [백준 6198, 옥상 정원 꾸미기] (0) | 2026.04.14 |