#include <bits/stdc++.h>
using namespace std;
int main() {
int p1, p2, p3;
string s;
cin >> p1 >> p2 >> p3 >> s;
for (int i = 0; i < s.length(); ++i) {
if (s[i] == '-' && i > 0) {
string str = "";
if (s[i + 1] == s[i - 1] + 1)
s.erase(i, 1);
else if (s[i + 1] > s[i - 1] && ((isdigit(s[i - 1]) && isdigit(s[i + 1])) || (islower(s[i - 1]) && (islower(s[i + 1]))))) {
char ch = 0;
int num = 1;
if (p1 != 3) {
while (ch + 1 < s[i + 1]) {
ch = s[i - 1] + num;
++num;
for (int j = 0; j < p2; ++j)
str += ch;
}
for (int j = 0; j < str.length(); j++) {
if (isalpha(s[i - 1])) {
if (p1 == 1)
str[j] = tolower(str[j]);
else
str[j] = toupper(str[j]);
}
}
}
else
for (int i = 0; i < p2; i++)
str += "*";
if (p3 == 2)
reverse(str.begin(), str.end());
s.erase(i, 1);
s.insert(i, str);
}
else
continue;
}
}
cout << s;
}