This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
def solve(A, B):
n = len(A)
m = len(B)
common = 0
L = []
M = []
for i in range(n):
for j in range(i+1, n):
s = A[i:j]
u = []
for k in s:
u.append(k)
u.sort()
L.append(u)
for i in range(m):
for j in range(i+1, m):
s = B[i:j]
u = []
for k in s:
u.append(k)
u.sort()
M.append(u)
for i in L:
for j in M:
if i == j and common < len(i):
common = len(i)
return common
def main():
A = raw_input()
B = raw_input()
print solve(A, B)
return
main()
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |