Having learned about the longest common substring and longest common subsequence, Bob is now interested in finding the shortest non-common substring and subsequence between two strings. Given two strings and
, Bob wants to find out the following numbers:
: The length of the shortest substring in
that is not a substring in
.
: The length of the shortest substring in
that is not a subsequence in
.
: The length of the shortest subsequence in
that is not a substring in
.
: The length of the shortest subsequence in
that is not a subsequence in
.
Your task is to write a program to help Bob find these numbers.
Input Specification
The first line of input contains the string (
).
The second line of input contains the string (
).
Both strings and
consist of only lower alphabetical letters.
Output Specification
Output four lines, where each line contains one number in the above order from to
. If there is no such answer, output
.
Constraints
Subtask | Points | Additional constraints |
---|---|---|
No additional constraints. |
Sample Input 1
aabbcc
abcabc
Sample Output 1
2
4
2
4
Explanation
aa
is the shortest substring in, but not a substring in
;
aabb
is the shortest substring in, but not a subsequence in
;
ac
is the shortest subsequence in, but not a substring in
;
aabb
is the shortest subsequence in, but not a subsequence in
.
Sample Input 2
aabbcc
aabbcc
Sample Output 2
-1
-1
2
-1
Comments