#P1953. 易语言
易语言
Description
Recently, the teacher has been studying Yi Language, a visual programming system for Windows, developed by Dalian Dayou Wutao Software Development Company, and possessing Chinese intellectual property rights. To learn this system better, the teacher deliberately uses it in practice to develop programs.
Today, the teacher encountered a problem: “When uploading testdata to KOJ, the testdata need to be renamed to the corresponding filenames.” For example, if the original testdata filenames are and , then the teacher needs to rename all files to and . The program interface is shown in the figure below:
(Note: An image seems to be missing here, but it does not affect understanding of the problem.)
Of course, the teacher is a novice at programming and is far less skilled than you, so the program is not good. Now the teacher would like you to help improve it.
In advance, the teacher will tell you the target filename format to be generated. For example, if the teacher tells you and , it means the basename of the input files in the target set is , the extension is , and the index starts from and follows the basename. Naturally, the output filenames will be $\text{enger0.ans,\,enger1.ans\;...\;enger}x\text{.ans}$, where can be determined by counting how many original filenames the teacher provides. In addition, the teacher will also tell you the full names of all original input files, such as . However, the teacher is careless. Do not expect the filenames to be given in ascending order of their indices, but the provided filenames are guaranteed to be correct and to follow general input/output filename conventions (the index number definitely appears at the end of the basename or at the end of the extension, and aside from this index number, no other digits will appear anywhere in either the original filenames or the target filenames).
Some original input/output filenames do not need changes to the basename or extension; only the file index needs to be changed. In this case, the teacher will first tell you a number (or ), meaning the basename and extension of the final target files should not be changed, and only the indices should be renumbered to start from (or ).
Input Format
The first line of input has two possibilities:
- Two strings, which specify the format of the final target filenames (the first string is the name of the first input file in the generated target set).
- A single number (or ), meaning the basename and extension do not need to change, and filenames only need to be renumbered starting from (or ).
Then follow lines (). Each line contains two strings separated by a single space, representing the original input and output filenames, respectively. For all input and output filenames, the basename and extension are each at most characters, and the maximum file index does not exceed .
Output Format
Output lines. Each line contains two strings separated by a single space, representing the final target filenames: the first is the input filename, and the second is the output filename. Output in ascending order of index.
enger0.in ans
abc1.in abc1.out
abc2.in abc2.out
abc3.in abc3.out
abc4.in abc4.out
enger0.in enger0.ans
enger1.in enger1.ans
enger2.in enger2.ans
enger3.in enger3.ans
1
aa.in0 aa.ou0
aa.in1 aa.ou1
aa.in2 aa.ou2
aa.in1 aa.ou1
aa.in2 aa.ou2
aa.in3 aa.ou3
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号