Given two strings
and
,
print the maximum
such that the prefix of length
of
is equal to the suffix of length
of
.
Input
Input consists of several cases, each one with
and
.
Every string is made up of between 1 and
lowercase letters.
Output
For every case, print
.
About statements
The official statement of a problem is always the one
in the PDF document. The HTML version of the statement
is also given to help you, but may contain some content
that is not well displayed. In case of doubt, always use the PDF.
Public test cases
Input
a b
z z
barbacoa acabar
cabar abacar
cabar acabat
cabar acabar
abacad ababa
acad academiacad
Output
0
1
3
0
0
5
3
4
Input
a b
z z
barbacoa acabar
cabar abacar
cabar acabat
cabar acabar
abacad ababa
acad academiacad