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()
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
2 KB |
Output is correct |
2 |
Correct |
119 ms |
3 KB |
Output is correct |
3 |
Execution timed out |
1083 ms |
6 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1075 ms |
36 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1079 ms |
36 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1082 ms |
41 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |