No.547 Unknown Language
タグ : / 解いたユーザー数 649
作問者 :
butsurizuki
/ テスター :
はむこ
Preface (you can solve the problem without reading this part)
y has warped to a region where an unknown language is used.
There was one person there who could talk with y, but one day that person disappeared.
y tried to learn the unknown language on their own.
y recalled, one after another, pairs of sentences written in the unknown language along with their translations.
In every pair, the sentences differ in one place in meaning and in exactly one word, and y is trying to guess the meaning of the differing word.
Problem Statement
You are given sentences $S,T$, each consisting of $N$ words.
The two sentences differ in exactly one word, so output the position of the differing word and the differing word from each sentence.
Input
$N$ $S_1$ $S_2$ … $S_N$ $T_1$ $T_2$ … $T_N$
The first line contains $N$, and the second and third lines contain $S,T$ respectively, with words separated by spaces.
・Constraints
$1 \le N \le 10$
$S_i,T_i$ all consist of uppercase or lowercase English letters
$1 \le |S_i , T_i| \le 20$
($1 \le i \le N$, $|X|$ is the length of string $X$)
Exactly one of the pairs $Si$ and $Ti$ differs
Output
On the first line, output the position of the differing word; on the second line, the differing word in S; on the third line, the differing word in T.
Print a newline at the end.
Sample
Sample 1
Input
4 ab cd ef gh ab cd xx gh
Output
3 ef xx
Sample 2
Input
1 a b
Output
1 a b
There are also cases with only one word.
Sample 3
Input
3 Mlsp fCcYlj gVvloth Mlsp DaYexUR gVvloth
Output
2 fCcYlj DaYexUR
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。