#include <bits/stdc++.h>
using namespace std;
int p1,p2,p3;
string s,S;
char a(char t){
if(p1==3){
return '*';
}else if(p1==1){
return tolower(t);
}else{
return toupper(t);
}
}
int main() {
cin>>p1>>p2>>p3>>s;
s = " "+s+" ";
for(int i = 1;i<s.size()-1;i++){
if(s[i]!='-'){
S+=s[i];
}else{
char zuo = s[i-1],you = s[i+1];
if(zuo<you && (islower(zuo) && islower(you) || isdigit(zuo) && isdigit(you))){
if(p3==1){
for(char i = zuo+1;i<=you-1;i++){
for(int j = 1;j<=p2;j++){
S+=a(i);
}
}
}else{
for(char i = you-1;i>=zuo+1;i--){
for(int j = 1;j<=p2;j++){
S+=a(i);
}
}
}
}else{
S+='-';
}
}
}
cout<<S;
return 0;
}