Longest common suffix: Difference between revisions
Added Arturo implementation
(Longest common suffix en FreeBASIC) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 746:
['remark', 'spark', 'aardvark', 'lark'] -> 'ark'
['ectoplasm', 'banana', 'brick'] -> ''</pre>
=={{header|Arturo}}==
<lang rebol>lcs: function [l][
ret: ""
idx: 0
lst: map l => reverse
while [true] [
thisLetter: ""
loop lst 'word [
if idx=size word -> return reverse ret
if thisLetter="" -> thisLetter: get split word idx
if thisLetter<>get split word idx -> return reverse ret
]
ret: ret ++ thisLetter
idx: idx + 1
]
]
print lcs ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday"]
print lcs ["throne" "throne"]
print lcs ["throne" "dungeon"]
print lcs ["cheese"]
print lcs ["prefix" "suffix"]</lang>
{{out}}
<pre>day
throne
cheese
fix</pre>
=={{header|AutoHotkey}}==
Line 774 ⟶ 808:
fix
bar</pre>
=={{header|AWK}}==
<lang AWK>
|