AugensTren @ 2022-04-23 14:48:40
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int iscalcu(char c) {
return ((c=='+')||(c=='-')||(c=='*')||(c=='/'));
}
int main() {
int num[1000] = {0}, top_loc = -1;
int temp = 0;
char s[1000];
memset(s, 0, 1000);
int i, j;
fgets(s, 1000, stdin);
int l = strlen(s);
while ( s[l] == '\r' || s[l] == '\n') s[l--] = '\0';
for(i = 0; s[i] != '@'; i++) {
if(isdigit(s[i])) {
temp = 0;
while (s[i] != '.') {
temp = temp*10 + s[i] - '0';
i++;
}
num[++top_loc] = temp;
}
if(iscalcu(s[i])) {
if(s[i] == '+') {
num[top_loc-1] = num[top_loc-1] + num[top_loc--];
}
if(s[i] == '-') {
num[top_loc-1] = num[top_loc-1]-num[top_loc--];
}
if(s[i] == '*') {
num[top_loc-1]=num[top_loc-1]*num[top_loc--];
}
if(s[i] == '/') {
num[top_loc-1]=num[top_loc-1]/num[top_loc--];
}
}
}
printf("%d\n",num[0]);
return 0;
}