Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
141668 | 秦炜杰 | 行编辑程序 | C++ | 解答错误 | 28 | 0 MS | 256 KB | 501 | 2024-04-06 09:44:10 |
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; stack<char> st,stt; int k=0; for(int i=s.size()-1;i>=0;i--){ if(s[i]=='@'){ k=i; break; } } for(int i=k;i<s.size();i++){ if(s[i]=='#'&&st.size()) st.pop(); else if(s[i]=='@'&&st.size()){ while(!st.empty()) st.pop(); } else st.push(s[i]); } while(!st.empty()){ stt.push(st.top()); st.pop(); } while(!stt.empty()){ cout<<stt.top(); stt.pop(); } return 0; }