#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;

string s;
string solve(int l, int r) {
    int pos = l;
    string ret = "";
    for(pos=l; pos<r; pos++) {
        int cnt = 0;
        while(s[pos] == '-' || s[pos] == '+') {
            if(s[pos] == '-') cnt = (cnt - 1 + 26) % 26;
            if(s[pos] == '+') cnt = (cnt + 1 + 26) % 26;
            pos++;
        }
        if(isalpha(s[pos])) {
            char c = (char)('A' + (s[pos] - 'A' + cnt) % 26);
            ret += c;
        }
        else if(s[pos] == '?') ret += 'A';
        else if(s[pos] == '[') {
            int par = 0, tmp_l = pos+1;
            while(1) {
                if(s[pos] == '[') par++;
                if(s[pos] == ']') {
                    par--;
                    if(par == 0) {
                        int tmp_r = pos;
                        string tmp = solve(tmp_l, tmp_r);
                        reverse(tmp.begin(), tmp.end());
                        ret += tmp;
                        break;
                    }
                }
                pos++;
            }
        }
    }
    return ret;
}

int main() {
    while(cin >> s) {
        if(s == ".") break;
        int N = s.length();
        cout << solve(0, N) << endl;
    }
    return 0;
}
