RosettaCodeData/Task/Longest-common-subsequence/Logo/longest-common-subsequence.logo
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

9 lines
263 B
Text

to longest :s :t
output ifelse greater? count :s count :t [:s] [:t]
end
to lcs :s :t
if empty? :s [output :s]
if empty? :t [output :t]
if equal? first :s first :t [output combine first :s lcs bf :s bf :t]
output longest lcs :s bf :t lcs bf :s :t
end