In the question of "reading the program to write the result" of the Junior group of the preliminary round, we gave an example of string expansion: if the input string contains a substring similar to d-h
or 4-8
, We take it as a shorthand. When outputting, replace the minus sign with a string of continuously increasing letters or numbers, that is, output the above two substrings as defgh
and 45678
respectively. In this question, we make the string expansion more flexible by adding some parameter settings. The specific agreement is as follows:
When encountering the following situation, it is necessary to expand the string: in the input string, a minus sign
-
appears, and both sides of the minus sign are lowercase letters or numbers, and in the order ofASCII
codes, The character to the right of the minus sign is strictly greater than the character to the left.Parameter : expansion method. When , for alphabetic substrings, fill with lowercase letters; when , for alphabetic substrings, fill with uppercase letters. The numeric substrings are padded the same way in both cases. When , whether it is a alphabetic or numeric substring, it is filled with the same number of asterisks
*
as the number of letters to be filled.Parameter : the number of repetitions of padding characters. means that the same character should be filled times consecutively. For example, when , the substring
d-h
should expand todeeeffffgggh
. The characters on either side of the minus sign are unchanged.Parameter : Whether to change to reverse order: means to maintain the original order, means to use reverse order output, note that the characters at both ends of the minus sign are still not included. For example, when , the substring
d-h
should be expanded todggffeeh
.If the character on the right of the minus sign happens to be the successor of the character on the left, only delete the minus sign in the middle, for example:
d-e
should be output asde
, and3-4
should be output as34
. If the character to the right of the minus sign is less than or equal to the character to the left in ASCII code order, keep the minus sign in the middle, for example:d-d
should be output asd-d
,3-1
should be output as3-1
.
Input Specification
Two lines:
- Line contains positive integers, representing the parameters .
- Line is a string consisting only of numbers, lowercase letters, and a minus sign
-
. It's guaranteed that the line has no trailing spaces.
Output Specification
One line, the expanded string.
Sample Input 1
1 2 1
abcs-w1234-9s-4zz
Sample Output 1
abcsttuuvvw1234556677889s-4zz
Sample Input 2
2 3 2
a-d-d
Sample Output 2
aCCCBBBd-d
Sample Input 3
3 4 2
di-jkstra2-6
Sample Output 3
dijkstra2************6
Constraints
of the data satisfy that the length of string is at most .
of the data satisfy , , , and the length of the string is at most .
Comments