Longest substrings without repeating characters: Difference between revisions

(Add APL)
Line 601:
</pre>
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="future basic">
local fn substrings(@ t as CFStringRef )
int beg, c, f, rpt, max = 0
for beg = 0 to len(t)//-1
rpt = instr( beg+1, t, mid(t, beg, 1), NSCaseInsensitiveSearch )
if rpt < 0 then rpt = len(t)
c = beg + 1
while c < rpt
f = instr(c + 1, t, mid(t, c, 1), NSCaseInsensitiveSearch)
if f < 0 then f = len(t) else if f < rpt then rpt = f
c++
wend
if rpt - beg < max then continue
if rpt - beg > max then max = rpt - beg : mda_clear
mda_add(0) = mid(t, beg, rpt - beg)
next
print : print ," The string: """;t;""""
print ,"Substring/s: ";
for c = 0 to mda_count(0) -1
print """";mda(c);""" ";
next
print
end fn
 
window 1, @"Longest Substring/s Without Repeated Letters"
fn substrings(@"xyzyabcybdfd")
fn substrings(@"thisisastringtest")
fn substrings(@"My spoon is too big.")
fn substrings(@"Rosetta Code")
fn substrings(@"AaAaA")
fn substrings(@"abcdefghijklmnopqrstuvwxyz")
fn substrings(@"aaa aeiou uuu")
fn substrings(@"abcdABCD")
 
handleevents
</syntaxhighlight>
{{out}}
[[File:Longest Substrings without Repeated Letters.png]]
=={{header|Go}}==
{{trans|Wren}}
68

edits