40 lines
903 B
Plaintext
40 lines
903 B
Plaintext
/* NetRexx */
|
|
options replace format comments java crossref savelog symbols binary
|
|
|
|
unixdict = 'unixdict.txt'
|
|
do
|
|
wmax = Integer.MIN_VALUE
|
|
dwords = ArrayList()
|
|
inrdr = BufferedReader(FileReader(File(unixdict)))
|
|
loop label ln while inrdr.ready
|
|
dword = Rexx(inrdr.readLine).strip
|
|
if isOrdered(dword) then do
|
|
dwords.add(dword)
|
|
if dword.length > wmax then
|
|
wmax = dword.length
|
|
end
|
|
end ln
|
|
inrdr.close
|
|
|
|
witerator = dwords.listIterator
|
|
loop label wd while witerator.hasNext
|
|
dword = Rexx witerator.next
|
|
if dword.length < wmax then do
|
|
witerator.remove
|
|
end
|
|
end wd
|
|
dwords.trimToSize
|
|
|
|
say dwords.toString
|
|
|
|
catch ex = IOException
|
|
ex.printStackTrace
|
|
end
|
|
|
|
return
|
|
|
|
method isOrdered(dword = String) inheritable static binary returns boolean
|
|
wchars = dword.toCharArray
|
|
Arrays.sort(wchars)
|
|
return dword.equalsIgnoreCase(String(wchars))
|