sdut 1479行编译器!!
2014-02-24 20:13
369 查看
点击打开链接
#include<stdio.h> #include<string.h> #include<stack> using namespace std; stack<char>s; int main() { char ch[1000],sh[1000]; while(scanf("%s",sh)!=EOF) { int len=strlen(sh); for(int i=0;i<len;i++) { if(sh[i]!='#'&&sh[i]!='@') { s.push(sh[i]); } else if(sh[i]=='#'&&!s.empty()) s.pop(); else if(sh[i]=='@') { while(!s.empty()) { s.pop(); } } } int j=0; while(!s.empty()) { ch[j++]=s.top();//出栈时的字符顺序是反的,要另存 s.pop(); } ch[j]='\0';//数组的结束标志 for(int i=j-1;i>=0;i--) printf("%c",ch[i]); printf("\n"); } return 0; }
相关文章推荐
- 糖果传递 (数学题)
- .反射机制基础类
- Binder源码分析之ServiceManager(原)
- Vijos P1102 陶陶摘苹果
- HDU 2845 Beans
- spring hibernate
- SQL SERVER的表锁
- IEnumerator对象有什么呢?
- Bee-Framework初探
- 【c++】PAT (Advanced Level)1010. Radix (25)
- 深入理解linux网络技术内幕--通知链
- UILable 的 属性设置
- LightOJ 1422 Halloween Costumes 动态规划
- ubuntu 12.04中安装配置svn服务器
- 关于Struts2的一点知识01
- OCP-1Z0-053-V13.02-691题
- SQLServer系统函数(2)_字符串函数
- ATL与WTL中CString的使用, 利用ATLCString获得窗口的文字.
- WINCE6.0中断实验总结
- CSS网页宽度的几个方案