11209: ABC374 - B - Unvarnished Report
Description
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 $S$ and $T$, consisting of lowercase English letters.
If $S$ and $T$ are equal, print $0$; otherwise, print the position of the first character where they differ.
Here, if the $i$-th character exists in only one of $S$ and $T$, consider that the $i$-th characters are different.
More precisely, if $S$ and $T$ are not equal, print the smallest integer $i$ satisfying one of the following conditions:
- $1\leq i\leq |S|$, $1\leq i\leq |T|$, and $S_i\neq T_i$.
- $|S| < i \leq |T|$.
- $|T| < i \leq |S|$.
Here, $|S|$ and $|T|$ denote the lengths of $S$ and $T$, respectively, and $S_i$ and $T_i$ denote the $i$-th characters of $S$ and $T$, respectively.
Input
The input is given from Standard Input in the following format:
$S$
$T$
Output
If $S$ and $T$ are equal, print $0$; otherwise, print the position of the first character where they differ.
Constraints
Sample 1 Input
abcde
abedc
Sample 1 Output
3
We have $S=$ abcde
and $T=$ abedc
.
$S$ and $T$ have the same first and second characters, but differ at the third character, so print $3$.
Sample 2 Input
abcde
abcdefg
Sample 2 Output
6
We have $S=$ abcde
and $T=$ abcdefg
.
$S$ and $T$ are equal up to the fifth character, but only $T$ has a sixth character, so print $6$.
Sample 3 Input
keyence
keyence
Sample 3 Output
0