ABC words
- Definition
A word is an ABC word if the letters "a", "b" and "c" appear in the word in alphabetical order.
If any or all of these letters occur more than once in a word, then only the first occurrence of each letter should be used to determine whether a word is an ABC word or not.
- Task
Show here (on this page) every ABC word in unixdict.txt.
- Metrics
- Counting
- Word frequency
- Letter frequency
- Jewels and stones
- Bioinformatics/base count
- Count occurrences of a substring
- Remove/replace
- XXXX redacted
- Remove vowels from a string
- Strip block comments
- Strip comments from a string
- Strip a set of characters from a string
- Strip whitespace from a string -- top and tail
- Strip control codes and extended characters from a string
- Anagrams/Derangements/shuffling
- Word wheel
- ABC problem
- Anagrams
- Anagrams/Deranged anagrams
- Permutations/Derangements
- Superpermutation minimisation
- Sattolo cycle
- Knuth shuffle
- Ordered words
- Textonyms (using a phone text pad)
- Find/Search/Determine
- ABC words
- Odd words
- Semordnilap
- Similar words
- String matching
- Alternade words
- Changeable words
- String comparison
- Extract file extension
- Levenshtein distance
- Palindrome detection
- Compare a list of strings
- Longest common prefix
- Longest common suffix
- Longest common substring
- Find common directory path
- Non-continuous subsequences
- Longest common subsequence
- Longest palindromic substrings
- Longest increasing subsequence
- Words containing "the" substring
- Determine if a string is numeric
- Determine if a string is collapsible
- Determine if a string is squeezable
- Determine if a string has all unique characters
- Determine if a string has all the same characters
- Find words which odd letters are consonants and even letters are vowels or vice_versa
- Formatting
- String case
- Align columns
- Literals/String
- Repeat a string
- Brace expansion
- Brace expansion using ranges
- Reverse a string
- Phrase reversals
- Comma quibbling
- Special characters
- String concatenation
- Substring/Top and tail
- Commatizing numbers
- Reverse words in a string
- Suffixation of decimal numbers
- Numerical and alphabetical suffixes
- Abbreviations, easy
- Abbreviations, simple
- Abbreviations, automatic
- Song lyrics/poems/Mad Libs/phrases
- 99 Bottles of Beer
- The Twelve Days of Christmas
- The Old lady swallowed a fly
- The Name Game (a song)
- Magic 8-ball
- Mad Libs
- Tokenize
- Word break problem
- Tokenize a string
- Tokenize a string with escaping
- Split a character string based on change of character
- Sequences
Contents
ALGOL 68[edit]
# find words that have "a", "b" and "C" in order in them #
IF FILE input file;
STRING file name = "unixdict.txt";
open( input file, file name, stand in channel ) /= 0
THEN
# failed to open the file #
print( ( "Unable to open """ + file name + """", newline ) )
ELSE
# file opened OK #
BOOL at eof := FALSE;
# set the EOF handler for the file #
on logical file end( input file, ( REF FILE f )BOOL:
BEGIN
# note that we reached EOF on the #
# latest read #
at eof := TRUE;
# return TRUE so processing can continue #
TRUE
END
);
INT abc count := 0;
WHILE STRING word;
get( input file, ( word, newline ) );
NOT at eof
DO
IF INT w pos := LWB word;
INT w max = UPB word;
INT a pos := w max + 1;
INT b pos := w max + 1;
INT c pos := w max + 1;
char in string( "a", a pos, word );
char in string( "b", b pos, word );
char in string( "c", c pos, word );
a pos < b pos
AND b pos < c pos
AND c pos <= w max
THEN
abc count +:= 1;
print( ( whole( abc count, -5 ), ": ", word, newline ) )
FI
OD;
close( input file )
FI
- Output:
1: aback 2: abacus 3: abc 4: abdicate 5: abduct 6: abeyance 7: abject 8: abreact 9: abscess 10: abscissa 11: abscissae 12: absence 13: abstract 14: abstracter 15: abstractor 16: adiabatic 17: aerobacter 18: aerobic 19: albacore 20: alberich 21: albrecht 22: algebraic 23: alphabetic 24: ambiance 25: ambuscade 26: aminobenzoic 27: anaerobic 28: arabic 29: athabascan 30: auerbach 31: diabetic 32: diabolic 33: drawback 34: fabric 35: fabricate 36: flashback 37: halfback 38: iambic 39: lampblack 40: leatherback 41: metabolic 42: nabisco 43: paperback 44: parabolic 45: playback 46: prefabricate 47: quarterback 48: razorback 49: roadblock 50: sabbatical 51: snapback 52: strabismic 53: syllabic 54: tabernacle 55: tablecloth
AWK[edit]
The following one-liner entered into a Posix shell returns the same 55 words as other entries.
awk '/^[^bc]*a[^c]*b.*c/' unixdict.txt
C#[edit]
Takes an optional command line for other character combinations. User can specify any reasonable number of unique characters. Caveat: see discussion page for issue about specifying repeated characters.
class Program {
static void Main(string[] args) { int bi, i = 0; string chars = args.Length < 1 ? "abc" : args[0];
foreach (var item in System.IO.File.ReadAllLines("unixdict.txt")) {
int ai = -1; foreach (var ch in chars)
if ((bi = item.IndexOf(ch)) > ai) ai = bi; else goto skip;
System.Console.Write("{0,3} {1,-18} {2}", ++i, item, i % 5 == 0 ? "\n" : "");
skip: ; } }
}
- Output:
Without command line arguments:
1 aback 2 abacus 3 abc 4 abdicate 5 abduct 6 abeyance 7 abject 8 abreact 9 abscess 10 abscissa 11 abscissae 12 absence 13 abstract 14 abstracter 15 abstractor 16 adiabatic 17 aerobacter 18 aerobic 19 albacore 20 alberich 21 albrecht 22 algebraic 23 alphabetic 24 ambiance 25 ambuscade 26 aminobenzoic 27 anaerobic 28 arabic 29 athabascan 30 auerbach 31 diabetic 32 diabolic 33 drawback 34 fabric 35 fabricate 36 flashback 37 halfback 38 iambic 39 lampblack 40 leatherback 41 metabolic 42 nabisco 43 paperback 44 parabolic 45 playback 46 prefabricate 47 quarterback 48 razorback 49 roadblock 50 sabbatical 51 snapback 52 strabismic 53 syllabic 54 tabernacle 55 tableclothWith command line argument "alw":
1 afterglow 2 airflow 3 alewife 4 allentown 5 alleyway 6 allow 7 allowance 8 alway 9 always 10 baldwin 11 barlow 12 bartholomew 13 bungalow 14 caldwell 15 candlewick 16 cauliflower 17 fallow 18 foamflower 19 galloway 20 gallows 21 galway 22 halfway 23 hallow 24 halloween 25 hallway 26 malawi 27 mallow 28 marlowe 29 marshmallow 30 mayflower 31 metalwork 32 railway 33 sallow 34 saltwater 35 sandalwood 36 shadflower 37 shallow 38 stalwart 39 tailwind 40 tallow
C++[edit]
#include <cstdlib>
#include <fstream>
#include <iostream>
bool is_abc_word(const std::string& word) {
bool a = false;
bool b = false;
for (char ch : word) {
switch (ch) {
case 'a':
if (!a)
a = true;
break;
case 'b':
if (!b) {
// fail if we haven't seen 'a' yet
if (!a)
return false;
b = true;
}
break;
case 'c':
// succeed iff we've seen 'b' already
return b;
}
}
return false;
}
int main(int argc, char** argv) {
const char* filename(argc < 2 ? "unixdict.txt" : argv[1]);
std::ifstream in(filename);
if (!in) {
std::cerr << "Cannot open file '" << filename << "'.\n";
return EXIT_FAILURE;
}
std::string word;
int n = 1;
while (getline(in, word)) {
if (is_abc_word(word))
std::cout << n++ << ": " << word << '\n';
}
return EXIT_SUCCESS;
}
- Output:
1: aback 2: abacus 3: abc 4: abdicate 5: abduct 6: abeyance 7: abject 8: abreact 9: abscess 10: abscissa 11: abscissae 12: absence 13: abstract 14: abstracter 15: abstractor 16: adiabatic 17: aerobacter 18: aerobic 19: albacore 20: alberich 21: albrecht 22: algebraic 23: alphabetic 24: ambiance 25: ambuscade 26: aminobenzoic 27: anaerobic 28: arabic 29: athabascan 30: auerbach 31: diabetic 32: diabolic 33: drawback 34: fabric 35: fabricate 36: flashback 37: halfback 38: iambic 39: lampblack 40: leatherback 41: metabolic 42: nabisco 43: paperback 44: parabolic 45: playback 46: prefabricate 47: quarterback 48: razorback 49: roadblock 50: sabbatical 51: snapback 52: strabismic 53: syllabic 54: tabernacle 55: tablecloth
FreeBASIC[edit]
#define NOTINSTRING 9999
function first_occ( s as string, letter as string ) as uinteger
for i as ubyte = 1 to len(s)
if mid(s,i,1) = letter then return i
next i
return NOTINSTRING - asc(letter)
end function
function is_abc( s as string ) as boolean
if first_occ( s, "a" ) > first_occ( s, "b" ) then return false
if first_occ( s, "b" ) > first_occ( s, "c" ) then return false
if first_occ( s, "c" ) > len(s) then return false
return true
end function
dim as string word
dim as uinteger c = 0
open "unixdict.txt" for input as #1
while true
line input #1, word
if word="" then exit while
if is_abc( word ) then
c+=1
print c;". ";word
end if
wend
close #1
- Output:
1. aback 2. abacus 3. abc 4. abdicate 5. abduct 6. abeyance 7. abject 8. abreact 9. abscess 10. abscissa 11. abscissae 12. absence 13. abstract 14. abstracter 15. abstractor 16. adiabatic 17. aerobacter 18. aerobic 19. albacore 20. alberich 21. albrecht 22. algebraic 23. alphabetic 24. ambiance 25. ambuscade 26. aminobenzoic 27. anaerobic 28. arabic 29. athabascan 30. auerbach 31. diabetic 32. diabolic 33. drawback 34. fabric 35. fabricate 36. flashback 37. halfback 38. iambic 39. lampblack 40. leatherback 41. metabolic 42. nabisco 43. paperback 44. parabolic 45. playback 46. prefabricate 47. quarterback 48. razorback 49. roadblock 50. sabbatical 51. snapback 52. strabismic 53. syllabic 54. tabernacle 55. tablecloth
Go[edit]
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
)
func main() {
wordList := "unixdict.txt"
b, err := ioutil.ReadFile(wordList)
if err != nil {
log.Fatal("Error reading file")
}
bwords := bytes.Fields(b)
count := 0
fmt.Println("Based on first occurrences only, the ABC words in", wordList, "are:")
for _, bword := range bwords {
a := bytes.IndexRune(bword, 'a')
b := bytes.IndexRune(bword, 'b')
c := bytes.IndexRune(bword, 'c')
if a >= 0 && b > a && c > b {
count++
fmt.Printf("%2d: %s\n", count, string(bword))
}
}
}
- Output:
Based on first occurrences only, the ABC words in unixdict.txt are: 1: aback 2: abacus 3: abc 4: abdicate 5: abduct 6: abeyance 7: abject 8: abreact 9: abscess 10: abscissa 11: abscissae 12: absence 13: abstract 14: abstracter 15: abstractor 16: adiabatic 17: aerobacter 18: aerobic 19: albacore 20: alberich 21: albrecht 22: algebraic 23: alphabetic 24: ambiance 25: ambuscade 26: aminobenzoic 27: anaerobic 28: arabic 29: athabascan 30: auerbach 31: diabetic 32: diabolic 33: drawback 34: fabric 35: fabricate 36: flashback 37: halfback 38: iambic 39: lampblack 40: leatherback 41: metabolic 42: nabisco 43: paperback 44: parabolic 45: playback 46: prefabricate 47: quarterback 48: razorback 49: roadblock 50: sabbatical 51: snapback 52: strabismic 53: syllabic 54: tabernacle 55: tablecloth
Java[edit]
import java.io.BufferedReader;
import java.io.FileReader;
public class AbcWords {
public static void main(String[] args) {
String fileName = "unixdict.txt";
String chars = "abc";
for (int i = 0; i + 1 < args.length
&& args[i].length() > 1
&& args[i].charAt(0) == '-'; ++i) {
switch (args[i].charAt(1)) {
case 'f':
fileName = args[++i];
break;
case 'c':
chars = args[++i];
break;
}
}
try {
try (BufferedReader reader = new BufferedReader(new FileReader(fileName))) {
String line;
int n = 0;
while ((line = reader.readLine()) != null) {
if (match(line, chars)) {
++n;
System.out.print(String.format("%3d: %-20s", n, line));
if (n % 3 == 0)
System.out.println();
}
}
if (n > 0 && n % 3 != 0)
System.out.println();
}
} catch (Exception e) {
e.printStackTrace();
}
}
// Returns true if word contains every character in chars in the
// same order. chars may contain the same character more than once.
private static boolean match(String word, String chars) {
int length = chars.length();
boolean[] seen = new boolean[length];
int wordLength = word.length();
for (int w = 0; w < wordLength; ++w) {
char ch = word.charAt(w);
int index = -1;
for (int c = 0; c < length; ++c) {
if (ch == chars.charAt(c) && !seen[c]) {
index = c;
break;
}
}
if (index == -1)
continue;
if (index + 1 == length)
return index == 0 ? true : seen[index - 1];
if (index > 0 && !seen[index - 1])
return false;
seen[index] = true;
}
return false;
}
}
- Output:
With no command line arguments:
1: aback 2: abacus 3: abc 4: abdicate 5: abduct 6: abeyance 7: abject 8: abreact 9: abscess 10: abscissa 11: abscissae 12: absence 13: abstract 14: abstracter 15: abstractor 16: adiabatic 17: aerobacter 18: aerobic 19: albacore 20: alberich 21: albrecht 22: algebraic 23: alphabetic 24: ambiance 25: ambuscade 26: aminobenzoic 27: anaerobic 28: arabic 29: athabascan 30: auerbach 31: diabetic 32: diabolic 33: drawback 34: fabric 35: fabricate 36: flashback 37: halfback 38: iambic 39: lampblack 40: leatherback 41: metabolic 42: nabisco 43: paperback 44: parabolic 45: playback 46: prefabricate 47: quarterback 48: razorback 49: roadblock 50: sabbatical 51: snapback 52: strabismic 53: syllabic 54: tabernacle 55: tablecloth
With command line arguments "-c pmm":
1: anthropomorphism 2: epigrammatic 3: epimorphism 4: euphemism 5: optimism 6: optimum 7: pandemonium 8: pantomime 9: pantomimic 10: pemmican 11: persimmon 12: pessimism 13: pessimum 14: plummet 15: postmortem 16: pragmatism 17: praseodymium 18: premium 19: primitivism 20: programmable 21: programmed 22: programmer 23: programming 24: promethium 25: pummel 26: supremum
Julia[edit]
See Alternade_words#Julia for the foreachword function.
function isabcword(w, _)
positions = [findfirst(c -> c == ch, w) for ch in "abc"]
return all(!isnothing, positions) && issorted(positions) ? w : ""
end
foreachword("unixdict.txt", isabcword)
- Output:
Word source: unixdict.txt aback abacus abc abdicate abduct abeyance abject abreact abscess abscissa abscissae absence abstract abstracter abstractor adiabatic aerobacter aerobic albacore alberich albrecht algebraic alphabetic ambiance ambuscade aminobenzoic anaerobic arabic athabascan auerbach diabetic diabolic drawback fabric fabricate flashback halfback iambic lampblack leatherback metabolic nabisco paperback parabolic playback prefabricate quarterback razorback roadblock sabbatical snapback strabismic syllabic tabernacle tablecloth
Perl[edit]
Outputs same 55 words everyone else finds.
#!/usr/bin/perl
@ARGV = 'unixdict.txt';
print grep /^[^bc]*a[^c]*b.*c/, <>;
Phix[edit]
function abc(string word)
sequence idii = apply(true,find,{"abc",{word}})
return find(0,idii)==0 and idii==sort(idii)
end function
sequence words = filter(get_text("demo/unixdict.txt",GT_LF_STRIPPED),abc)
printf(1,"%d abc words found: %s\n",{length(words),join(shorten(words,"",3),", ")})
- Output:
55 abc words found: aback, abacus, abc, ..., syllabic, tabernacle, tablecloth
Python[edit]
Outputs the same 55 words as other examples when entered in a Posix terminal shell
python -c '
import sys
for ln in sys.stdin:
if "a" in ln and ln.find("a") < ln.find("b") < ln.find("c"):
print(ln.rstrip())
' < unixdict.txt
Raku[edit]
put 'unixdict.txt'.IO.words».fc.grep({ (.index('a')//next) < (.index('b')//next) < (.index('c')//next) })\
.&{"{+$_} words:\n " ~ .batch(11)».fmt('%-12s').join: "\n "};
- Output:
55 words: aback abacus abc abdicate abduct abeyance abject abreact abscess abscissa abscissae absence abstract abstracter abstractor adiabatic aerobacter aerobic albacore alberich albrecht algebraic alphabetic ambiance ambuscade aminobenzoic anaerobic arabic athabascan auerbach diabetic diabolic drawback fabric fabricate flashback halfback iambic lampblack leatherback metabolic nabisco paperback parabolic playback prefabricate quarterback razorback roadblock sabbatical snapback strabismic syllabic tabernacle tablecloth
REXX[edit]
This REXX version doesn't care what order the words in the dictionary are in, nor does it care what
case (lower/upper/mixed) the words are in, the search for the ABC words is caseless.
It also allows the (ABC) characters to be specified on the command line (CL) as well as the dictionary file identifier.
/*REXX program finds all the caseless alternade words (within an identified dictionary).*/
parse arg minL iFID . /*obtain optional arguments from the CL*/
if minL=='' | minL=="," then minL= 6 /*Not specified? Then use the default.*/
if iFID=='' | iFID=="," then iFID='unixdict.txt' /* " " " " " " */
@.= /*default value of any dictionary word.*/
do #=1 while lines(iFID)\==0 /*read each word in the file (word=X).*/
x= strip( linein( iFID) ) /*pick off a word from the input line. */
$.#= x; upper x; @.x= . /*save: original case and the semaphore*/
end /*#*/ /* [↑] semaphore name is uppercased. */
#= # - 1 /*adjust word count because of DO loop.*/
finds= 0 /*count of the alternade words found. */
say copies('─', 30) # "words in the dictionary file: " iFID
say
do j=1 for #; L= length($.j) /*process all the words that were found*/
if L<minL then iterate /*Is word too short? Then ignore it. */
p.= /*initialize 2 parts of alternade word.*/
do k=1 for L; _= k // 2 /*build the " " " " " */
p._= p._ || substr($.j, k, 1) /*append to one part of alternade word.*/
end /*k*/
parse upper value p.0 p.1 with p0 p1 /*obtain the uppercase alternade parts.*/
if @.p0=='' | @.p1=='' then iterate /*either parts of alternade not extant?*/
finds= finds + 1 /*bump the count of alternades found.*/
say right(left($.j, 20), 25) left(p.1, 10) left(p.0, 10) /*indent a bit.*/
end /*j*/
/*stick a fork in it, we're all done. */
say copies('─',30) finds ' alternade words found with a minimum length of ' minL
- output when using the default input:
────────────────────────────── 25104 words in the dictionary file: unixdict.txt aback abacus abc abdicate abduct abeyance abject abreact abscess abscissa abscissae absence abstract abstracter abstractor adiabatic aerobacter aerobic albacore alberich albrecht algebraic alphabetic ambiance ambuscade aminobenzoic anaerobic arabic athabascan auerbach diabetic diabolic drawback fabric fabricate flashback halfback iambic lampblack leatherback metabolic nabisco paperback parabolic playback prefabricate quarterback razorback roadblock sabbatical snapback strabismic syllabic tabernacle tablecloth ────────────────────────────── 55 "ABC" words found using the characters: abc
- output when using the (vowels in order) input: aeiou
────────────────────────────── 25104 words in the dictionary file: unixdict.txt adventitious facetious ────────────────────────────── 2 "ABC" words found using the characters: aeiou
Ring[edit]
cStr = read("unixdict.txt")
wordList = str2list(cStr)
num = 0
see "ABC words are:" + nl
for n = 1 to len(wordList)
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
if bool4 = 1 and bool5 = 1
num = num + 1
see "" + num + ". " + wordList[n] + nl
ok
next
Output:
ABC words are: 1. aback 2. abacus 3. abc 4. abdicate 5. abduct 6. abeyance 7. abject 8. abreact 9. abscess 10. abscissa 11. abscissae 12. absence 13. abstract 14. abstracter 15. abstractor 16. adiabatic 17. aerobacter 18. aerobic 19. albacore 20. alberich 21. albrecht 22. algebraic 23. alphabetic 24. ambiance 25. ambuscade 26. aminobenzoic 27. anaerobic 28. arabic 29. athabascan 30. auerbach 31. diabetic 32. diabolic 33. drawback 34. fabric 35. fabricate 36. flashback 37. halfback 38. iambic 39. lampblack 40. leatherback 41. metabolic 42. nabisco 43. paperback 44. parabolic 45. playback 46. prefabricate 47. quarterback 48. razorback 49. roadblock 50. sabbatical 51. snapback 52. strabismic 53. syllabic 54. tabernacle 55. tablecloth
Swift[edit]
import Foundation
func loadDictionary(_ path: String) throws -> [String] {
let contents = try String(contentsOfFile: path, encoding: String.Encoding.ascii)
return contents.components(separatedBy: "\n")
}
func isAbcWord(_ word: String) -> Bool {
var a = false
var b = false
for ch in word {
switch (ch) {
case "a":
if !a {
a = true
}
case "b":
if !b {
if !a {
return false
}
b = true
}
case "c":
return b
default:
break
}
}
return false
}
do {
let dictionary = try loadDictionary("unixdict.txt")
var n = 1
for word in dictionary {
if isAbcWord(word) {
print("\(n): \(word)")
n += 1
}
}
} catch {
print(error)
}
- Output:
1: aback 2: abacus 3: abc 4: abdicate 5: abduct 6: abeyance 7: abject 8: abreact 9: abscess 10: abscissa 11: abscissae 12: absence 13: abstract 14: abstracter 15: abstractor 16: adiabatic 17: aerobacter 18: aerobic 19: albacore 20: alberich 21: albrecht 22: algebraic 23: alphabetic 24: ambiance 25: ambuscade 26: aminobenzoic 27: anaerobic 28: arabic 29: athabascan 30: auerbach 31: diabetic 32: diabolic 33: drawback 34: fabric 35: fabricate 36: flashback 37: halfback 38: iambic 39: lampblack 40: leatherback 41: metabolic 42: nabisco 43: paperback 44: parabolic 45: playback 46: prefabricate 47: quarterback 48: razorback 49: roadblock 50: sabbatical 51: snapback 52: strabismic 53: syllabic 54: tabernacle 55: tablecloth
Wren[edit]
import "io" for File
import "/fmt" for Fmt
var wordList = "unixdict.txt" // local copy
var words = File.read(wordList).trimEnd().split("\n")
var count = 0
System.print("Based on first occurrences only, the ABC words in %(wordList) are:")
for (word in words) {
var a = word.indexOf("a")
var b = word.indexOf("b")
var c = word.indexOf("c")
if (a >= 0 && b > a && c > b) {
count = count + 1
Fmt.print("$2d: $s", count, word)
}
}
- Output:
Based on first occurrences only, the ABC words in unixdict.txt are: 1: aback 2: abacus 3: abc 4: abdicate 5: abduct 6: abeyance 7: abject 8: abreact 9: abscess 10: abscissa 11: abscissae 12: absence 13: abstract 14: abstracter 15: abstractor 16: adiabatic 17: aerobacter 18: aerobic 19: albacore 20: alberich 21: albrecht 22: algebraic 23: alphabetic 24: ambiance 25: ambuscade 26: aminobenzoic 27: anaerobic 28: arabic 29: athabascan 30: auerbach 31: diabetic 32: diabolic 33: drawback 34: fabric 35: fabricate 36: flashback 37: halfback 38: iambic 39: lampblack 40: leatherback 41: metabolic 42: nabisco 43: paperback 44: parabolic 45: playback 46: prefabricate 47: quarterback 48: razorback 49: roadblock 50: sabbatical 51: snapback 52: strabismic 53: syllabic 54: tabernacle 55: tablecloth
XPL0[edit]
string 0; \use zero-terminated strings
int I, J, K, Ch, Len;
char Word(100); \(longest word in unixdict.txt is 22 chars)
def LF=$0A, CR=$0D, EOF=$1A;
[FSet(FOpen("unixdict.txt", 0), ^I); \open dictionary and set it to device 3
OpenI(3);
repeat I:= 0;
loop [repeat Ch:= ChIn(3) until Ch # CR; \remove possible CR
if Ch=LF or Ch=EOF then quit;
Word(I):= Ch;
I:= I+1;
];
Word(I):= 0; \terminate string
Len:= I;
for I:= 0 to Len-1 do
if Word(I)=^a then
[for J:= 0 to Len-1 do
if Word(J)=^b then
[for K:= 0 to Len-1 do
if Word(K)=^c then
[if K>J & J>I then
[Text(0, Word); CrLf(0)];
K:= Len;
];
J:= Len;
];
I:= Len;
];
until Ch = EOF;
]
- Output:
aback abacus abc abdicate abduct abeyance abject abreact abscess abscissa abscissae absence abstract abstracter abstractor adiabatic aerobacter aerobic albacore alberich albrecht algebraic alphabetic ambiance ambuscade aminobenzoic anaerobic arabic athabascan auerbach diabetic diabolic drawback fabric fabricate flashback halfback iambic lampblack leatherback metabolic nabisco paperback parabolic playback prefabricate quarterback razorback roadblock sabbatical snapback strabismic syllabic tabernacle tablecloth