Submission #953611


Source Code Expand

Copy
N = int(input())
S = input()
T = input()
ans = -1
for i in range(N):
    # print(S[i:], T[:N-i])
    if S[i:] == T[:N-i]:
        ans = N + i
        break
if ans == -1:
    ans = N * 2
print(ans)

Submission Info

Submission Time
Task A - Prefix and Suffix
User poyodr
Language Python3 (3.4.3)
Score 200
Code Size 209 Byte
Status
Exec Time 23 ms
Memory 3064 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt
All 200 / 200 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt
Case Name Status Exec Time Memory
0_00.txt 23 ms 3064 KB
0_01.txt 22 ms 3064 KB
0_02.txt 22 ms 3064 KB
1_00.txt 22 ms 3064 KB
1_01.txt 22 ms 3064 KB
1_02.txt 23 ms 3064 KB
1_03.txt 23 ms 3064 KB
1_04.txt 22 ms 3064 KB
1_05.txt 23 ms 3064 KB