分享至
給你兩個字串,要如何找出最長重複部分?例如輸入:
abbdf abdfsv
輸出:
ab
已邀請的邦友 {{ invite_list.length }}/5
stringA = "abbdf" stringB = "abdfsv" for i, char in enumerate(stringA): if char == stringB[i]: print(char, end='')
https://www.geeksforgeeks.org/print-longest-common-substring/
被你搶先一步
A = "abbdf" B = "abdfsv" for i in range(len(A)): if A[i] == B[i]: print(A[i])
IT邦幫忙