#abc374b. B - Unvarnished Report
B - Unvarnished Report
Score : points
问题陈述
KEYENCE 有一种实事求是的报告文化,无论好坏。 因此,我们想检查报告的内容是否与原始文本完全相同。
你有两个由小写英文字母组成的字符串 和 。 如果 和 相等,打印 ;否则,打印它们第一个不同字符的位置。 这里,如果第 个字符只存在于 或 中,就认为第 个字符是不同的。
更精确地说,如果 和 不相等,打印最小的整数 ,满足以下条件之一:
- , , 且 。
- 。
- 。
这里, 和 分别表示 和 的长度, 和 分别表示 和 的第 个字符。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
KEYENCE has a culture of reporting things as they are, whether good or bad.
So we want to check whether the reported content is exactly the same as the original text.
You are given two strings and , consisting of lowercase English letters.
If and are equal, print ; otherwise, print the position of the first character where they differ.
Here, if the -th character exists in only one of and , consider that the -th characters are different.
More precisely, if and are not equal, print the smallest integer satisfying one of the following conditions:
- , , and .
- .
- .
Here, and denote the lengths of and , respectively, and and denote the -th characters of and , respectively.
Constraints
- and are strings of length between and , inclusive, consisting of lowercase English letters.
Input
The input is given from Standard Input in the following format:
Output
If and are equal, print ; otherwise, print the position of the first character where they differ.
Sample Input 1
abcde
abedc
Sample Output 1
3
We have abcde
and abedc
.
and have the same first and second characters, but differ at the third character, so print .
Sample Input 2
abcde
abcdefg
Sample Output 2
6
We have abcde
and abcdefg
.
and are equal up to the fifth character, but only has a sixth character, so print .
Sample Input 3
keyence
keyence
Sample Output 3
0
and are equal, so print .
相关
在下列比赛中: