#include <iostream>
#include <vector>
#include <cctype>
using namespace std;
bool flatten(vector<char>::iterator it, vector<char>::iterator begin, vector<char>::iterator end)
{
if (it == begin || it == end - 1)
return false;
char prev = *(it - 1);
char next = *(it + 1);
if (*it == '-')
{
bool isPrevAlpha = isalpha(prev);
bool isNextAlpha = isalpha(next);
bool isPrevDigit = isdigit(prev);
bool isNextDigit = isdigit(next);
if ((isPrevAlpha && isNextAlpha) || (isPrevDigit && isNextDigit))
{
if (prev >= next)
return false;
else
return true;
}
}
return false;
}
void print(int a, int b, int c, vector<char>::iterator &it, vector<char>::iterator begin, vector<char>::iterator end)
{
char x = *(it - 1);
char y = *(it + 1);
if (a == 3)
{
int n = b * (y - x - 1);
for (int i = 0; i < n; ++i)
cout << '*';
}
else
{
if (isalpha(x) && a == 2)
{
x = toupper(x);
y = toupper(y);
}
if (c == 1)
{
for (int i = 1; i < (y - x); ++i)
{
int j = b;
while (j--)
cout << (char)(x + i);
}
}
else
{
for (int i = 1; i < (y - x); ++i)
{
int j = b;
while (j--)
cout << (char)(y - i);
}
}
}
it++;
}
int main()
{
int p1, p2, p3;
cin >> p1 >> p2 >> p3;
cin.ignore();
vector<char> v;
string input;
getline(cin, input);
for (char ch : input)
{
v.push_back(ch);
}
for (auto it = v.begin(); it < v.end();)
{
if (!flatten(it, v.begin(), v.end()))
{
cout << *it;
++it;
}
else
{
if (*(it + 1) == *(it - 1) + 1)
{
++it;
cout << *it;
++it;
}
else
{
print(p1, p2, p3, it, v.begin(), v.end());
}
}
return 0;
}