While Mahmoud and Ehab were practicing for IOI, they found a problem which name was Longest common subsequence. They solved it, and then Ehab challenged Mahmoud with another problem.

Given two strings *a* and *b*, find the length of their longest uncommon subsequence, which is the longest string that is a subsequence of one of them and not a subsequence of the other.

A subsequence of some string is a sequence of characters that appears in the same order in the string, The appearances don't have to be consecutive, for example, strings "ac", "bc", "abc" and "a" are subsequences of string "abc" while strings "abbc" and "acb" are not. The empty string is a subsequence of any string. Any string is a subsequence of itself.
The first line contains string *a*, and the second line — string *b*. Both of these strings are non-empty and consist of lowercase letters of English alphabet. The length of each string is not bigger than 10<sup class="upper-index">5</sup> characters.
In the first example: you can choose "defgh" from string *b* as it is the longest subsequence of string *b* that doesn't appear as a subsequence of string *a*.
abcd
defgh
5
a
a
-1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacccccccccccccccccccccccccccccccccccccccccccccccccc
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadddddddddddddddddddddddddddddddddddddddddddddddddd
100
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
199
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbb
99
abcde
fghij
5
abcde
abcdf
5
abcde
bbcde
5
abcde
eabcd
5
abcdefgh
abdcefgh
8
mmmmm
mnmmm
5
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaa
34
abcdefghijklmnopqrstuvwxyz
zabcdefghijklmnopqrstuvwxy
26
a
ab
2
b
ab
2
ab
b
2
ab
c
2
aaaaaa
aaaaaa
-1
abacaba
abacaba
-1
aabb
bbaa
4
ab
ba
2
abcd
abc
4
abaa
abaa
-1
ab
ab
-1
ab
abcd
4
abc
abcd
4
mo
momo
4
koooooooooooooooo
loooooooooooooooo
17
aaa
aa
3
abc
abc
-1
abcd
abcd
-1
abc
cba
3
ahc
ahc
-1
abc
bac
3
aa
aaa
3
aaa
aaa
-1
abc
acb
3
abc
ab
3
abb
abb
-1
abc
cab
3
aaaaaa
aaaaa
6
aa
aab
3
len
lena
4
aaaaa
aa
5
aaa
aaaa
4
bcd
abcd
4
aaabbc
aaaccc
6
abcd
zycd
4
baa
zaa
3
asdf
adfs
4
abcdefgh
abcdefgh
-1
aba
aab
3
aba
aba
-1
abcccc
accccc
6
acb
abc
3
a
aa
2
abababab
ab
8
ababab
ab
6
s = input()
t = input()
if len(t) < len(s):
    s, t = t, s
a = set()
for i in s:
    a.add(i)
tmp = ''
ans = -1
for i in t:
    if i not in a:
        tmp += i
    else:
        ans = max(ans, len(tmp))
        tmp = ''
print(ans)