标签:des style blog color io ar for 数据 div
whli##ilr#e(s#*s) outcha@putchar(*s=#++);
while(*s) putchar(*s++);
一开始没理解题意,错了好几次!
代码:
#include <stdio.h>
#include <string.h>
#include <stack>
#include <algorithm>
using namespace std;
char s[400];
char t[400];
int main()
{
int i, j;
int len;
int e;
stack<char>ch;
while(scanf("%s", s)!=EOF)
{
len = strlen(s);
for(i=0; i<len ;i++)
{
if(s[i]==‘#‘ && ch.empty() )
{
continue; // 重点语句
}
else if(s[i]==‘#‘ && !ch.empty() )
{
ch.pop(); //重点语句
}
else if(s[i]==‘@‘)
{
while(!ch.empty())
{
ch.pop();
}
}
else
{
ch.push(s[i]);
}
}
e=0;
while(!ch.empty())
{
t[e++] = ch.top();
ch.pop();
}
for(i=e-1; i>=0; i--)
{
printf("%c", t[i] );
}
printf("\n");
}
return 0;
}
标签:des style blog color io ar for 数据 div
原文地址:http://www.cnblogs.com/yspworld/p/3980056.html