September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
22
Task/Ordered-words/BaCon/ordered-words.bacon
Normal file
22
Task/Ordered-words/BaCon/ordered-words.bacon
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
'Ordered words - improved version
|
||||
OPTION COLLAPSE TRUE
|
||||
|
||||
list$ = LOAD$("unixdict.txt")
|
||||
|
||||
FOR word$ IN list$ STEP NL$
|
||||
|
||||
SPLIT word$ BY 1 TO letter$ SIZE length
|
||||
SORT letter$ SIZE length
|
||||
JOIN letter$ BY "" TO term$ SIZE length
|
||||
|
||||
IF word$ = term$ THEN
|
||||
IF length > MaxLen THEN
|
||||
MaxLen = length
|
||||
result$ = word$
|
||||
ELIF length = MaxLen THEN
|
||||
result$ = APPEND$(result$, 0, word$, NL$)
|
||||
END IF
|
||||
END IF
|
||||
NEXT
|
||||
|
||||
PRINT result$
|
||||
Loading…
Add table
Add a link
Reference in a new issue