34 lines
716 B
Plaintext
34 lines
716 B
Plaintext
Procedure.b check_word(word$)
|
|
Shared letters$
|
|
If Len(word$)<3 Or FindString(word$,"k")<1
|
|
ProcedureReturn #False
|
|
EndIf
|
|
For i=1 To Len(word$)
|
|
If CountString(letters$,Mid(word$,i,1))<CountString(word$,Mid(word$,i,1))
|
|
ProcedureReturn #False
|
|
EndIf
|
|
Next
|
|
ProcedureReturn #True
|
|
EndProcedure
|
|
|
|
If ReadFile(0,"./Data/unixdict.txt")
|
|
txt$=LCase(ReadString(0,#PB_Ascii|#PB_File_IgnoreEOL))
|
|
CloseFile(0)
|
|
EndIf
|
|
|
|
If OpenConsole()
|
|
letters$="ndeokgelw"
|
|
wordcount=1
|
|
Repeat
|
|
buf$=StringField(txt$,wordcount,~"\n")
|
|
wordcount+1
|
|
If check_word(buf$)=#False
|
|
Continue
|
|
EndIf
|
|
PrintN(buf$) : r+1
|
|
Until buf$=""
|
|
PrintN("- Finished: "+Str(r)+" words found -")
|
|
Input()
|
|
EndIf
|
|
End
|