This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
a = input()
b = input()
maxi = 0
ans = []
for qq in range(2):
dp = [[0 for i in range(len(b)+1)]for j in range(len(a)+1)]
for i in range(1, len(a)+1):
for j in range(1, len(b)+1):
if a[i-1] == b[j-1]:
dp[i][j] = dp[i-1][j-1] + 1
else:
dp[i][j] = 0
if maxi < max([max(i) for i in dp]):
maxi = max([max(i) for i in dp])
ans = 0
for i in range(1, len(a)+1):
for j in range(1, len(b)+1):
if dp[i][j] == maxi:
if qq == 1:
ans = [i-maxi,len(b)-j]
else:
ans = [i-maxi,j-maxi]
b = b[::-1]
print(maxi)
print(ans[0], ans[1])
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |