ͷ͞ΛٻΊΑɽ ߟ͑ํ ߟྀ͢ΔจࣈྻΛগ͍ͣͭͯ͘͘͠͠ ʹ ಈతܭը๏ 1: procedure LongestCommonSubstring(X, Y ) 2: LCS ← (length(X) + 1) × (length(Y ) + 1) ͷද 3: for i ← 1 . . . length(X) + 1 do 4: for j ← 1 . . . length(Y ) + 1 do 5: d ← X[i] = Y [j] ͳΒ 1ɼͦΕҎ֎ͳΒ 0 6: LCS ← max(LCS[i − 1, j − 1] + d, 7: LCS[i − 1, j], LCS[i, j − 1]) 8: end for 9: end for 10: end procedure 19 / 21