#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
using namespace std;
int p1, p2, p3;
string s;
int main(void)
{
cin >> p1 >> p2 >> p3;
cin >> s;
int i = 0;
while (1)
{
if (s[i] == '-')
{
s.erase(i, 1);
continue;
}
else break;
}
while (1)
{
if (s[s.size()-1] == '-')
{
s.erase(s.size()-1, 1);
continue;
}
else break;
}
int pos = 0;
while (s.find('-', pos) != string::npos)
{
pos = s.find('-', pos);
string x1 = s.substr(pos - 1, 1);
string x2 = s.substr(pos + 1, 1);
if (x2[0] - x1[0] == 1)
{
s.erase(pos,1);
}
else if (x2[0] <= x1[0])
{
pos++;
continue;
}
else if ((((x2[0] >= 97 && x2[0] <= 122) && (x1[0] >= 97 && x1[0] <= 122)) ||
((x2[0] >= 48 && x2[0] <= 57) && (x1[0] >= 48 && x1[0] <= 57))) && (x2[0] > x1[0]))
{
s.erase(pos,1);//删除-
//需要展开
if (p1 == 1 && p3 == 1)
{
x1[0]++;//若二者都是小写字母
for (; x1[0] < x2[0]; x1[0]++)
{
s.insert(pos, p2, x1[0]);
pos =pos+p2;//pos也要移动
}
}
else if (p1 == 2 && p3 == 1)
{
if (!((x2[0] >= 48 && x2[0] <= 57) && (x1[0] >= 48 && x1[0] <= 57)))
{
//如果不是数字
x1[0]++;
for (; x1[0] < x2[0]; x1[0]++)
{
s.insert(pos, p2, (x1[0] - 32));//插入大写字母
pos = pos + p2;//pos也要移动
}
}
else
{
//插数字
x1[0]++;//若二者都是小写字母
for (; x1[0] < x2[0]; x1[0]++)
{
s.insert(pos, p2, x1[0]);
pos = pos + p2 ;//pos也要移动
}
}
}
else if (p1 == 3 && p3 == 1)
{
int count = 0;
x1[0]++;//若二者都是小写字母
for (; x1[0] < x2[0]; x1[0]++)
{
count++;
}
s.insert(pos, count * p2, '*');
pos += count * p2;//pos移动
}
else if (p1 == 1 && p3 == 2)//倒着插
{
x1[0]++;//若二者都是小写字母
char temp = x1[0];
for (; x1[0] < x2[0]; x1[0]++)
{
s.insert(pos, p2, x1[0]);
}
pos += (x2[0] - temp) * p2;
}
else if (p1 == 2 && p3 == 2)
{
if (!((x2[0] >= 48 && x2[0] <= 57) && (x1[0] >= 48 && x1[0] <= 57)))
{
//如果不是数字
x1[0]++;
char temp = x1[0];
for (; x1[0] < x2[0]; x1[0]++)
{
s.insert(pos, p2, (x1[0] - 32));//插入大写字母
}
pos += (x2[0] - temp) * p2;
}
else
{
//插数字
x1[0]++;//若二者都是小写字母
char temp = x1[0];
for (; x1[0] < x2[0]; x1[0]++)
{
s.insert(pos, p2, x1[0]);
}
pos += (x2[0] - temp) * p2;
}
}
else if (p1 == 3 && p3 == 2)
{
int count = 0;
x1[0]++;//若二者都是小写字母
for (; x1[0] < x2[0]; x1[0]++)
{
count++;
}
s.insert(pos, count * p2, '*');
pos += count * p2;//pos移动
}
}
else
{
pos++;
}
}
cout << s << endl;
}