1) Get the input of two similar strings, S and T, in separate lines
2) Make a variable: 'cnt', for counting the location of both string
3) Use a For loop in the range of length of S, to see when S[i] is different from T[i]
4) When S[i] is different from T[i], break, and print the counting variable: 'cnt'
5) If not, add 1 to the counting variable: 'cnt', and repeat this for the rest of the range
S = input()
T = input()
cnt = 1
for i in range(len(S)):
if S[i] != T[i]:
break
else:
cnt += 1
print(cnt)