Odd words

Revision as of 12:05, 5 December 2020 by CalmoSoft (talk | contribs) (Created page with "{{Draft task}} Given a list of words. (unixdict.txt)<br> Take odd indices letters from the word and if it is in list then display on this page. <br> The length of new word > 4...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Given a list of words. (unixdict.txt)
Take odd indices letters from the word and if it is in list then display on this page.
The length of new word > 4

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.

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