def common_prefix(a, b):
    i = 0
    for i, (x, y) in enumerate(zip(a, b)):
        if x != y:
            break
    return a[:i]


a = input()
b = input()
c = common_prefix(a, b)
print(c)

3d03fd8d5b4fddb83cc8217a0bfd8d90f13bcec3
<mask token>

def common_prefix(a, b):
    i = 0
    for i, (x, y) in enumerate(zip(a, b)):
        if x != y:
            break
    return a[:i]


<mask token>

def common_prefix(a, b):
    i = 0
    for i, (x, y) in enumerate(zip(a, b)):
        if x != y:
            break
    return a[:i]


<mask token>
print(c)

def common_prefix(a, b):
    i = 0
    for i, (x, y) in enumerate(zip(a, b)):
        if x != y:
            break
    return a[:i]


a = input()
b = input()
c = common_prefix(a, b)
print(c)
