#include <iostream>
#include <cctype>
#include <algorithm>

using namespace std;

std::string repeat(char ch, int times) {
    std::string str;
    str.resize(times);
    for (int i = 0; i < times; ++i) {
        str[i] = ch;
    }
    return str;
}

std::string refold(char chPrev, char chNext, int mode, int times,
                   bool reverse) {
    if (chNext <= chPrev) {
        return "-";
    }
    if (chNext - chPrev == 1) {
        return "";
    }
    std::string str;
    if (mode == 1 || mode == 2) {
        if (isalpha(chPrev) && isalpha(chNext)) {
            chPrev = mode == 1 ? chPrev : chPrev - 32;
            chNext = mode == 1 ? chNext : chNext - 32;
            for (char ch = chPrev + 1; ch < chNext; ++ch) {
                str += repeat(ch, times);
            }
        } else if (isdigit(chPrev) && isdigit(chNext)) {
            for (char ch = chPrev + 1; ch < chNext; ++ch) {
                str += repeat(ch, times);
            }
        } else {
            return "-";
        }
    } else {
        str += repeat('*', (chNext - chPrev - 1) * times);
    }
    if (reverse) {
        std::reverse(str.begin(), str.end());
    }
    return str;
}

int main() {
    int p1, p2, p3;
    std::string str;
    std::cin >> p1 >> p2 >> p3 >> str;
    std::string newStr;
    for (int i = 0; i < str.length(); ++i) {
        if (str[i] == '-') {
            if (i == 0 || i == str.length() - 1) {
                newStr += str[i];
            } else {
                newStr += refold(str[i - 1], str[i + 1], p1, p2, p3 == 2);
            }
        } else {
            newStr += str[i];
        }
    }
    std::cout << newStr << std::endl;
}
// 64 位输出请用 printf("%lld")