2021工大杯题解-A
个人题解,和比赛官方无关,仅供参考
Changing problem statement during contest
It is well known that we should not change the problem statement during the contest. But, we also know that a company named “Hua***” liked to change problem statement during the contest .
There were some breathtaking errors in the problem statements during the 2021 ICPC Asia Regionals Online Contest (I). So, naturally, we needed to change these statements.
For example, problem A needs change. As we all know, the word “lexicographic” means "order of the dictionary(字典序), ‘a generalization of the alphabetical order of the dictionaries to sequences of ordered symbols.’ ", but somehow the person who wrote this problem misinterpreted the word as “ascending”.
Naturally, during reasonable contests, what he needs to do is to update the testcase data, changing it from ascending order to lexicographic order, matching the problem statement, then rejudge all submissions of
this problem. But, he doesn’t think it that way. “Why changing testcase data while we can change the problem statement?” Surely he didn’t know that submitting “Wrong Answer” would add penalty(罚时) to the team’s time cost. I mean, otherwise, why would he do this?
Can you help him change all “lexicographic” to “ascending”?
Input
The first line of input contains a integer $n$. $(1 \leq n \leq 100)$.
In the following $n$ lines, each line contains a string. It is guaranteed that the length of the string is less than $100$ characters, and the string only contains a
to z
.
Output
Output updated problem statements, replace all lexicographic
by ascending
.
Examples
Example 1
Input
1 | 14 |
Output
1 |
|
Example 2
Input
1 | 1 |
Output
1 | whoalexicographic |
In the first example, we replace “lexicographic” on the 10th line to
“ascending”.
In the second example, we do nothing because we don’t need to replace
word containing “lexicographic”.
题解
题目难度:简单。
阅读题面之后会发现是一个非常简单的字符串比较。循环 $n$ 次,每次读入一个字符串,如果是lexicographic
就替换为ascending
就好了。
标准答案:
1 |
|
1 |
|