Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
141632 | 刘嘉乐 | 行编辑程序 | C++ | 运行出错 | 92 | 0 MS | 252 KB | 442 | 2024-04-06 09:14:26 |
#include<bits/stdc++.h> using namespace std; stack<char> ste; char a[10000005]; int main(){ string s; getline(cin,s); for(int i=0;i<s.size();i++){ if(s[i]!='#'&&s[i]!='@')ste.push(s[i]); else if(s[i]=='#'){ ste.pop(); }else{ while(!ste.empty())ste.pop(); } } int n = ste.size(); for(int i=0,j=n;i<n;i++,j--){ a[j] = ste.top(); ste.pop(); } for(int i=1;i<=n;i++){ cout<<a[i]; } return 0; }