include <iostream> #include <string> using namespace std; int main() { string word; cin >> word; string ans; int i = 0; while (i < word.length()) { char c = word[i]; if (c == '+' || c == '-') { i++; char direction = c; int j = i; while (j < word.length() && word[j] != '+' && word[j] != '-') { j++; } if (direction == '+') { for (int k = i; k < j; k++) { ans += word[k]; } } else { for (int k = j - 1; k >= i; k--) { ans += word[k]; } } i = j; } else { ans += c; i++; } } cout << ans << endl; return 0; }