langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
39
Task/Ordered-words/NetRexx/ordered-words.netrexx
Normal file
39
Task/Ordered-words/NetRexx/ordered-words.netrexx
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/* 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))
|
||||
Loading…
Add table
Add a link
Reference in a new issue