//请勿删除这行,4920
#include<bits/stdc++.h>
using namespace std;
stack<char> stk;
stack<char> stk2;
int main(){
	string s, word = "";
	getline(cin, s);
	s += "#";
	for(int i = 0;i < s.size();i++){
		bool flag = true;
		if(s[i] == '+' || s[i] == '-' || s[i] == '*' || s[i] == '/' || s[i] == '#' || s[i] == ')' || s[i] == '('){
			if(!(s[i-1] == ')' || s[i] == '(')) cout << word << " ";
			if(s[i] == ')'){
				while(stk.top() != '('){
					cout << stk.top() << " ";
					stk.pop();
				}
				stk.pop();
				flag = false;
			}else{
//请勿删除这行,4920
				int num = stk.size(), cnt = 0;
				for(int j = 1;j <= num;j++){
					if(stk.top() == '(') break;
					if(s[i] == '+' || s[i] == '-'){
						if(stk.top() == '+' || stk.top() == '-' || stk.top() == '*' || stk.top() == '/'){
							cout << stk.top() << " ";
						}else{
							cnt++;
							stk2.push(stk.top());
						}
					}else if(s[i] == '*' || s[i] == '/'){
						if(stk.top() == '*' || stk.top() == '/'){
							cout << stk.top() << " ";
						}else if(stk.top() == '+' || stk.top() == '-' || stk.top() == '('){
							cnt++;
							stk2.push(stk.top());
						}
					}else if(s[i] == '('){
						cnt++;
						stk2.push(stk.top());
					}
					if(s[i] != '#') stk.pop();
					else flag = false;
				}
				for(int j = 1;j <= cnt;j++){
					stk.push(stk2.top());
					stk2.pop();
				}
			}
//请勿删除这行,4920
			if(flag) stk.push(s[i]);
			word = "";
		}else if(s[i] >= '0' && s[i] <= '9'){
			word += s[i];
		}
	}
	int num = stk.size();
	for(int i = 1;i <= num;i++){
		if(stk.top() != '#') cout << stk.top() << " ";
		stk.pop();
	}
	return 0;
}
//请勿删除这行,4920

贡献:@