#SDNU1714. Unvarnished Report

Unvarnished Report

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 SS and TT, consisting of lowercase English letters.
If SS and TT are equal, print 00; otherwise, print the position of the first character where they differ.
Here, if the ii-th character exists in only one of SS and TT, consider that the ii-th characters are different.

More precisely, if SS and TT are not equal, print the smallest integer ii satisfying one of the following conditions:

  • 1iS1\leq i\leq |S|, 1iT1\leq i\leq |T|, and SiTiS_i\neq T_i.
  • S<iT|S| < i \leq |T|.
  • T<iS|T| < i \leq |S|.

Here, S|S| and T|T| denote the lengths of SS and TT, respectively, and SiS_i and TiT_i denote the ii-th characters of SS and TT, respectively.

Constraints

  • SS and TT are strings of length between 11 and 100100, inclusive, consisting of lowercase English letters.

Input

The input is given from Standard Input in the following format:

SS

TT

Output

If SS and TT are equal, print 00; otherwise, print the position of the first character where they differ.

Sample Input 1

abcde
abedc

Sample Output 1

3

We have S=S= abcde and T=T= abedc.
SS and TT have the same first and second characters, but differ at the third character, so print 33.

Sample Input 2

abcde
abcdefg

Sample Output 2

6

We have S=S= abcde and T=T= abcdefg.
SS and TT are equal up to the fifth character, but only TT has a sixth character, so print 66.

Sample Input 3

keyence
keyence

Sample Output 3

0

SS and TT are equal, so print 00.