文章
1
粉丝
169
获赞
0
访问
9.7k
 
#include <iostream>
#include <string.h>
#include <stack>
using namespace std;
int main()
{
    int N;
    cin>>N;
    string a;
    stack<char>st;
    while(N--)
    {
        cin>>a;
        int i,j;
        int life=1;
        while(!st.empty()){
            st.pop();
        }
        for(i=0;i<a.size();i++){
            switch(a[i])
            {
            case '<':
                if(st.empty()){
                    st.push(a[i]);
                    break;
  &nbs...
登录后发布评论
st没有元素时,调用top()函数会崩溃