#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5;
int a,b,c;
string s;
int main(){
cin >>a >>b >>c >>s;
vector<string>ans;
for(int i=0;i<s.size();i++){
if(s[i]=='-'){
char l=s[i-1],r=s[i+1];
if(l+1==r)continue;
if(l>=r||(!((l>='a'&&l<='z'&&r>='a'&&r<='z')||(l>='0'&&l<='9'&&r>='0'&&r<='9')))){
ans.push_back("-");
continue;
}
string t="";
if(l>='0'&&l<='9'){
for(char j=l+1;j<=r-1;j++){
for(int k=1;k<=b;k++){
t+=(a==3?'*':j);
}
}
}
else{
for(char j=l+1;j<=r-1;j++){
for(int k=1;k<=b;k++){
if(a==1)t+=tolower(j);
if(a==2)t+=toupper(j);
if(a==3)t+='*';
}
}
}
if(c==2){
reverse(t.begin(),t.end());
}
ans.push_back(t);
}
}
int now=0;
for(auto x:s){
if(x=='-'){
if(ans.size()){
cout <<ans[now];
now++;
}
}
else cout <<x;
}
return 0;
}