June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -1,8 +1 @@
|
|||
function isordered{T<:String}(w::T)
|
||||
p = '\0'
|
||||
for c in w
|
||||
p <= c || return false
|
||||
p = c
|
||||
end
|
||||
return true
|
||||
end
|
||||
issorted("abc") # true
|
||||
|
|
|
|||
|
|
@ -1,20 +1,4 @@
|
|||
maxlen = 0
|
||||
wlst = String[]
|
||||
WL = open("ordered_words.txt", "r")
|
||||
|
||||
for w in eachline(WL)
|
||||
w = chomp(w)
|
||||
wlen = length(w)
|
||||
wlen>=maxlen && isordered(w) || continue
|
||||
if wlen > maxlen
|
||||
maxlen = wlen
|
||||
wlst = [w]
|
||||
else
|
||||
push!(wlst, w)
|
||||
end
|
||||
end
|
||||
close(WL)
|
||||
|
||||
for w in wlst
|
||||
println(" ", w)
|
||||
end
|
||||
lst = readlines("data/unixdict.txt")
|
||||
filter!(issorted, lst)
|
||||
filter!(x -> length(x) == maximum(length, lst), lst)
|
||||
println.(lst)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue