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

int main() {
    int p1, p2, p3;
    cin >> p1 >> p2 >> p3;
    string s;
    cin >> s;
    string res;
    int n = s.size();
    for (int i = 0; i < n; i++) {
        if (s[i] == '-' && i > 0 && i < n - 1) {
            char l = s[i - 1];
            char r = s[i + 1];
            bool same=(islower(l)&&islower(r))||(isdigit(l)&&isdigit(r));
            if(!same||r<=l){
                res+="-";
                continue;
            }
            if (r == l + 1) {
                continue;
            }
            int cnt=r-l-1;
            int tot=cnt*p2;
            string fill;
            if (p1 == 3) {
                fill = string(tot, '*');
            } 
            else {
                char start = l + 1;
                char end = r - 1;
                string temp;
                for (char c = start; c <= end; c++) {
                    for (int j = 0; j < p2; j++) {
                        temp += c;
                    }
                }
                if (p1 == 2) {
                    for (char& c : temp) {
                        if (islower(c))c = toupper(c);
                    }
                }
                fill += temp;
            }
            if (p3 == 2) {
                reverse(fill.begin(), fill.end());
            }
            res += fill;
        } 
        else res += s[i];
    }
    cout << res << endl;
    return 0;
}
// 64 位输出请用 printf("%lld")