在检查新城XML配置文件的标签匹配时,使用了栈结构。对于字符串 "" 的简化模拟 "<<" >> " ,以下代码的输出是什么?
#include <stack>
std::stack<char> st;
std::string s = "<<>>";
for (char c : s) {
if (c == '<') st.push(c);
else if (c == '>' && !st.empty()) st.pop();
}
if (st.empty()) cout << "Match";
else cout << "Error";
Match
Error
无输出
编译错误