No.2268 Avoiding NG Words
タグ : / 解いたユーザー数 93
作問者 : 👑
Moss_Local
Problem Statement
The input gives a positive integer $N$ and $N$ strings of length $N$ consisting only of the $2$ kinds of characters a and b. These $N$ strings are called NG words.
Find one string of length $N$ consisting only of a and b that is not an NG word.
It can be proved that such a string always exists.
Input
The input is given from standard input in $1 + N$ lines in the following format.
- Line $1$ contains $N$.
- For each positive integer $n$ not exceeding $N$, line $1 + n$ contains the $n$-th NG word.
Constraints
The input satisfies the following constraints:
- $N$ is an integer satisfying $1 \leq N \leq 10^3$
- Each NG word is a string of length $N$ consisting only of
aandb
Output
Output one string of length $N$ consisting only of a and b that is not an NG word.
This is a special judge problem. There may be more than one correct answer, but output only one of them.
Print a newline at the end.
Sample
Sample 1
Input
1 a
Output
b
The only NG word is a. Therefore, b is not an NG word. There are no other correct answers.
Sample 2
Input
2 ab ba
Output
aa
The only NG words are ab and ba. Therefore, aa is not an NG word. Besides this, bb is also a correct answer. There are no other correct answers.
Sample 3
Input
3 aaa bbb aaa
NG words may be duplicated, as in this case.
Output
aba
The only NG words are aaa and bbb. Therefore, aba is not an NG word. Besides this, strings such as abb are also correct answers.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。