RosettaCodeData/Task/ABC-Problem/Astro/abc-problem.astro

13 lines
410 B
Text
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
fun abc(s, ls):
if ls.isempty:
2018-08-17 15:15:24 +01:00
return true
for i in indices(list) where s[end] in list[i]:
2019-09-12 10:33:56 -07:00
return abc(s[:end-1], remove!(copy(list), at: i))
2017-09-23 10:01:46 +02:00
false
let test = ["A", "BARK","BOOK","TREAT","COMMON","SQUAD","CONFUSE"]
2019-09-12 10:33:56 -07:00
let ls = ["BO","XK","DQ","CP","NA","GT","RE","TG","QD","FS", "JW","HU","VI","AN","OB","ER","FS","LY","PC","ZM"]
2018-06-22 20:57:24 +00:00
2019-09-12 10:33:56 -07:00
for s in test:
print "($|>8|{s} ${abc(s, list)})"