Odd words
Odd words is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Given a list of words. (unixdict.txt)
Take odd indices letters from the word and if it is in the list then display on this page.
The length of new word > 4
Ring
<lang ring> cStr = read("unixdict.txt") wordList = str2list(cStr) num = 0
see "Odd words are:" + nl
for n = 1 to len(wordList)
strWord = "" len = len(wordList[n]) for m = 1 to len step 2 strWord = strWord + wordList[n][m] next ind = find(wordList,strWord) if ind > 0 and len(strWord) > 4 num = num + 1 see "" + num + ". " + wordList[n] + " >> " + strWord + nl ok
next </lang> Output:
Odd words are: 1. barbarian >> brain 2. childbear >> cider 3. corrigenda >> cried 4. gargantuan >> grata 5. headdress >> hades 6. palladian >> plain 7. propionate >> point 8. salvation >> slain 9. siltation >> slain 10. slingshot >> sight 11. statuette >> saute 12. supersede >> spree 13. supervene >> spree 14. terminable >> trial