Description
对于一个基于二元运算符的算术表达式,转换为对应的后缀式,并输出之。
Input
输入一个算术表达式,以‘#’字符作为结束标志。
Output
输出该表达式转换所得到的后缀式。
Sample
Input
a*b+(c-d/e)*f#
Output
ab*cde/-f*+
#define maxSize 1005
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef struct
{
int data[maxSize];
int top;
}S;
int main()
{
S s;
s.top = -1;
char c;
while(scanf("%c", &c) && c != '#')
{
if(c >= 'a' && c <= 'z')
{
printf("%c", c);
}
else if(c == '(')
{
s.data[++s.top] = c;
}
else if(c == ')')
{
while(s.data[s.top] != '(')
{
printf("%c", s.