Jump to content

Odd words: Difference between revisions

m
→‎version 2, caseless: adjusted the record count.
(Added Java solution)
m (→‎version 2, caseless: adjusted the record count.)
Line 713:
$.#= x; upper x; @.x= . /*save: original case and the semaphore*/
end /*#*/ /* [↑] semaphore name is uppercased. */
#= # - 1
minW= minL * 2 - 1 /*minimum width of a word to be usable.*/
say copies('─', 30) # "words in the dictionary file: " iFID
ows= 0 /*count of the "odd words" found. */
do j=1 for #-1; L= length($.j) /*process all the words that were found*/
if L<minW then iterate /*Is word too short? Then ignore it. */
ow= /*initialize the "odd word". */
Line 727 ⟶ 728:
say right(left($.j, 20), 24) left(ow, 9) /*indent original word for readability.*/
end /*j*/
say copies('─', 30) ows ' "odd words" found with a minimum length of ' minL</lang>
</lang>
{{out|output|text=&nbsp; when using the default input:}}
<pre>
────────────────────────────── 2510525104 words in the dictionary file: unixdict.txt
barbarian brain
childbear cider
Cookies help us deliver our services. By using our services, you agree to our use of cookies.