Longest substrings without repeating characters: Difference between revisions

added Arturo
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
(added Arturo)
Line 200:
longest : 'z'
</pre>
 
=={{header|Arturo}}==
 
<syntaxhighlight lang="arturo">unrepeatableSubstrings: function [s][
result: [["",0]]
 
if zero? s -> return []
if one? s -> return @[s]
 
loop 0..dec size s 'a [
if (a+1) =< dec size s [
loop a..dec size s 'b [
substr: to :string slice s a b
ss: size substr
if and? -> ss >= last maximum result 'x -> last x
-> substr = unique substr [
result: (select result 'x -> ss = last x) ++ @[@[substr, ss]]
]
]
]
]
result: unique map result 'x -> first x
return result
]
 
 
loop ["xyzyabcybdfd", "xyzyab", "zzzzz", "a", ""] 'str ->
print [str "=> longest unrepeatable substring:" unrepeatableSubstrings str]</syntaxhighlight>
 
{{out}}
 
<pre>xyzyabcybdfd => longest unrepeatable substring: [zyabc cybdf]
xyzyab => longest unrepeatable substring: [zyab]
zzzzz => longest unrepeatable substring: [z]
a => longest unrepeatable substring: [a]
=> longest unrepeatable substring: []</pre>
 
=={{header|AutoHotkey}}==
1,532

edits