問題一覧 > 通常問題

No.547 Unknown Language

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 649
作問者 : butsurizuki / テスター : はむこ
お気に入りにしたユーザー ProblemId : 1628 / 自分の提出
問題文最終更新日: 2026-06-26 06:07:31
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 170 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。