#include<bits/stdc++.h>
using namespace std;
#define isa(l) (l>='A'&&l<='Z') || (l>='a'&&l<='z')
#define isn(l) (l>='0'&&l<='9')
int p1,p2,p3;
string str;
int main(){
cin>>p1>>p2>>p3;
getline(cin,str);
getline(cin,str);
for(int i=0;i<str.size();i++){
if(str[i]=='-'){
char l=str[i-1],r=str[i+1];
bool botha=isa(l)&&isa(r);
bool bothn=isn(l)&&isn(r);
if(!(botha || bothn))continue;
if(l>=r)continue;
if(l==r-1){
str.erase(i,1);
i--;
continue;
}
string t;
if(p1!=3){
for(char j=l+1;j<r;j++){
if(bothn) t+=string(p2,j);
if(p1==1 && botha) t+=string(p2,tolower(j));
else if(p1==2 && botha)t+=string(p2,toupper(j));
}
}else{
t+=string(p2*(r-l-1),'*');
}
if(p3==2)reverse(t.begin(),t.end());
str.erase(i,1);
str.insert(i,t);
}
}
cout<<str;
return 0;
}