ABC words

From Rosetta Code
ABC 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.

A word is ABC word if "a", "b" and "c" letters appear in alphabetical order.

Ring

<lang ring> cStr = read("unixdict.txt") wordList = str2list(cStr) num = 0

see "ABC words are:" + nl

for n = 1 to len(wordList)

   cnt1 = count(wordList[n],"a")
   cnt2 = count(wordList[n],"b")
   cnt3 = count(wordList[n],"c")
   bool1 = substr(wordList[n],"a")
   bool2 = substr(wordList[n],"b")
   bool3 = substr(wordList[n],"c")
   bool4 = bool1 > 0 and bool2 > 0 and bool3 > 0
   bool5 = bool2 > bool1 and bool3 > bool2
   cnt = (cnt1 = 1) and (cnt2 = 1) and (cnt3 = 1)
   if bool4 = 1 and bool5 = 1 and cnt
      num = num + 1
      see "" + num + ". " + wordList[n] + nl
   ok

next

func count(cString,dString)

    sum = 0
    while substr(cString,dString) > 0
          sum++
          cString = substr(cString,substr(cString,dString)+len(string(sum)))
    end
    return sum

</lang> Output:

ABC words are:
1. abc
2. abduct
3. abject
4. abscess
5. absence
6. aerobic
7. alberich
8. albrecht
9. aminobenzoic
10. diabetic
11. diabolic
12. fabric
13. iambic
14. metabolic
15. nabisco
16. roadblock
17. strabismic
18. syllabic
19. tablecloth