Buggy python submission (verdict: Time Limit Exceeded):
while 1:
    try:
        s1 = raw_input()
    except: break
    s2 = raw_input()
    l = len(s1)
    f = False
    for i in range(l,0,-1):
        for j in range(0,l-i+1):
            if j+i > l: break
            x = s2.find(s1[j:j+i])
            if x != -1:
                f = True
                print i
                break
        if f: break
    if i == 1 and not f: print 0

Fixed submission:
while 1:
    try:
        s1 = raw_input()
        s2 = raw_input()
        if len(s1) < len(s2): s1,s2 = s2,s1
        l = sum(min(s1.count(i), s2.count(i)) for i in set(list(s1)) & set(list(s2)))
        if l == 0: print 0; continue
        ans = 0
        for i in range(len(s2)):
            if len(s2) - i <= ans: break
            for j in range(ans+1, min(l + 1,len(s2)-i+1)):
                if s2[i:i+j] in s1:
                    ans = j
                else: break
        print ans
    except:
        break

Buggy python submission (verdict: Time Limit Exceeded):
while 1:
    try:
        s1 = raw_input()
        s2 = raw_input()
        l = len(s1)
        f = False
        for i in range(l,0,-1):
            for j in range(0,l-i+1):
                if j+i > l: break
                x = s2.find(s1[j:j+i])
                if x != -1:
                    f = True
                    print i
                    break
            if f: break
        if i == 1 and not f: print 0
    except:
        break

Fixed submission:
while 1:
    try:
        s1 = raw_input()
        s2 = raw_input()
        if len(s1) < len(s2): s1,s2 = s2,s1
        l = sum(min(s1.count(i), s2.count(i)) for i in set(list(s1)) & set(list(s2)))
        if l == 0: print 0; continue
        ans = 0
        for i in range(len(s2)):
            if len(s2) - i <= ans: break
            for j in range(ans+1, min(l + 1,len(s2)-i+1)):
                if s2[i:i+j] in s1:
                    ans = j
                else: break
        print ans
    except:
        break

Buggy python submission (verdict: Time Limit Exceeded):
while 1:
    try:
        s1 = raw_input()
        s2 = raw_input()
        if len(s1) < len(s2): s1,s2 = s2,s1
        l = sum(min(s1.count(i), s2.count(i)) for i in set(list(s1)) & set(list(s2)))
        f = False
        for i in range(l,0,-1):
            for j in range(0,l-i+1):
                x = s2.find(s1[j:j+i])
                if x != -1:
                    f = True
                    print i
                    break
            if f: break
        if i == 1 and not f: print 0
    except:
        break

Fixed submission:
while 1:
    try:
        s1 = raw_input()
        s2 = raw_input()
        if len(s1) < len(s2): s1,s2 = s2,s1
        l = sum(min(s1.count(i), s2.count(i)) for i in set(list(s1)) & set(list(s2)))
        if l == 0: print 0; continue
        ans = 0
        for i in range(len(s2)):
            if len(s2) - i <= ans: break
            for j in range(ans+1, min(l + 1,len(s2)-i+1)):
                if s2[i:i+j] in s1:
                    ans = j
                else: break
        print ans
    except:
        break

Buggy python submission (verdict: Time Limit Exceeded):
while 1:
    try:
        s1 = raw_input()
        s2 = raw_input()
        if len(s1) < len(s2): s1,s2 = s2,s1
        l = sum(min(s1.count(i), s2.count(i)) for i in set(list(s1)) & set(list(s2)))
        if l == 0: print 0; continue
        f = False
        for i in range(l,0,-1):
            for j in range(len(s2)-i+1):
                if s2[j:j+i] in s1:
                    f = True
                    print i
                    break
            if f: break
    except:
        break

Fixed submission:
while 1:
    try:
        s1 = raw_input()
        s2 = raw_input()
        if len(s1) < len(s2): s1,s2 = s2,s1
        l = sum(min(s1.count(i), s2.count(i)) for i in set(list(s1)) & set(list(s2)))
        if l == 0: print 0; continue
        ans = 0
        for i in range(len(s2)):
            if len(s2) - i <= ans: break
            for j in range(ans+1, min(l + 1,len(s2)-i+1)):
                if s2[i:i+j] in s1:
                    ans = j
                else: break
        print ans
    except:
        break