import java.util.Scanner;
public class P1098字符串的展开 {
static int p1, p2, p3;
static char[] ca;
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
p1 = sc.nextInt();
p2 = sc.nextInt();
p3 = sc.nextInt();
String s = sc.next();
ca = s.toCharArray();
for (int i = 0; i < ca.length; i++) {
if (i+1<ca.length&&ca[i + 1] == '-') {
System.out.print(ca[i]);// s
if(i+1==ca.length-1) {
System.out.print(ca[i+1]);
break;
}else {
f1(i, i + 2);// s w
if(i+3<ca.length&&ca[i+3]=='-') {
i++;
}else {
System.out.print(ca[i + 2]);// w
i += 2;// i指向1
}
}
} else {
System.out.print(ca[i]);
}
}
}
static void f1(int x, int y) {// s w的下标
StringBuffer sb=new StringBuffer();
if (ca[x] >= ca[y]) {//ca[x]=s-115 ca[y]=w-119
System.out.print("-");
return;
}else if (f2(x, y)==0) {
System.out.print("-");
// System.out.println("***");
return;
}
else {
for(int i=ca[x]+1;i<ca[y];i++) {//i=116 i<=118
char c=(char)i;
if(p1==1&&c>='A'&&c<='Z'){
c+=32;
}else if (p1==2&&c>='a'&&c<='z') {
c-=32;
}
if(p1==3) {
c='*';
}
for(int j=0;j<p2;j++) {
sb.append(c);
}
}
}
if(p3==2) {
sb.reverse();
}
System.out.print(sb);
}
static int f2(int x,int y) {
if(ca[x]>='0'&&ca[x]<='9') {
if(!(ca[y]>='0'&&ca[y]<='9')) {
return 0;
}
}else if (ca[x]>='A'&&ca[x]<='Z') {
if(!(ca[y]>='A'&&ca[y]<='Z')) {
return 0;
}
}else if(ca[x]>='a'&&ca[x]<='z'){
if(!(ca[y]>='a'&&ca[y]<='z')) {
return 0;
}
}
return 1;
}
}