吐司 • 5个月前
using namespace std;
int main() {
//freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
stack<char>a;
string d;
int b, c = 0;
getline(cin, d);
for (int i = 0; i < d.size(); i++) {
if (d[i] == 'O') {
if (a.empty()) {
cout << "NO";
return 0;
}
a.pop();
}
if (d[i] == 'I') {
a.push(c);
}
}
cout << "YES";
return 0;
}
评论:
请先登录,才能进行评论