#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define PLUS 1 #define MINUS 2 int main() { char str[15]; scanf("%s", str); int op = 0; int val1, val2; int sp = !isdigit(str[0]); val1 = val2 = 0; for (int i = sp; str[i] != '\0'; i++) { if (isdigit(str[i-1]) && (str[i] == '+' || str[i] == '-')) { if (str[i] == '+') { op = MINUS; }else { op = PLUS; } sp = !isdigit(str[i+1]); for (int j = i+1+sp; str[j] != '\0'; j++) { val2 = val2*10+(str[j]-'0'); } if (op == MINUS) { val2 *= -1; } if (str[i+1] == '-') { val2 *= -1; } if (str[0] == '-') { val1 *= -1; } printf("%d\n", val1+val2); return 0; } val1 = val1*10+(str[i]-'0'); } }