Jump to content

Anadromes: Difference between revisions

m
simplify
(julia example)
m (simplify)
Line 53:
<lang ruby>function anadromes(minsize, csense = true, fname = "words.txt")
words = Set(filter(w -> length(w) >= minsize, split((csense ? identity : lowercase)(read(fname, String)), r"\s+")))
found = unique([sort!([w, reverse(w)]) for w in words if (r = reverse(w)) in words && w !=< reverse(w)r])
println("Total $(length(found)) case $(csense ? "" : in)sensitive anadrome pairs found.")
foreach(a -> println(a[1], " <=> ", a[2]), sort!(found))
4,105

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.