count. = 0
ws = ''
transtab = XRANGE('A', 'Z') || XRANGE('a', 'z')
transin  = XRANGE('A', 'Z')
transout = XRANGE('a', 'z')
notword  = XRANGE('00'x, D2C(C2D('a')-1)) || XRANGE(D2C(C2D('z')+1), 'FF'x)
DO UNTIL LINES() = 0
    PARSE LINEIN L

    L = TRANSLATE(TRANSLATE(L, transout, transin), '', notword, ' ')

    DO i = 1 TO WORDS(L)
        w = STRIP(WORD(L, i))
        count.w = count.w + 1
        IF count.w = 1 THEN ws = ws w
    END    
END

STREAM('rexx_tmp', 'C', 'CREATE')

DO i = 1 to WORDS(ws)
    w = WORD(ws, i)
    IF count.w > 0 THEN DO
        line = format(count.w, 7) || '09'x || w
        CALL LINEOUT('rexx_tmp', line)
    END
END

'c:\cygwin\bin\sort -nr rexx_tmp >rexx_sorted'

DO WHILE LINES('rexx_sorted') > 0
    SAY LINEIN('rexx_sorted')
END

/*
STREAM('rexx_tmp', 'C', 'CLOSE')
STREAM('rexx_sorted', 'C', 'CLOSE')

'del rexx_tmp'
'del rexx_sorted'
*/