//只能转换单个数字
#include<stdio.h>
#include<ctype.h>
#include<stdlib.h>
int lookahead;
void error()
{
printf("syntax error/n");
exit(1);
}
void match(int c)
{
if(lookahead==c)
lookahead=getchar();
else error();
}
void texm()
{
if(isdigit(lookahead) )
{
putchar(lookahead);
match(lookahead);
}
else error();
}
void rest()
{
if(lookahead=='+')
{
match('+');texm();putchar('+');rest();
}
else if(lookahead=='-')
{
match('-');texm();putchar('-');rest();
}
else exit(1);
}
void expr()
{
texm();
rest();
}
int main()
{
lookahead=getchar();
expr();
return 0;
}