DefDbl A-Z
Dim crlf$, grid(26, 26)
Private Sub Form_Load()
Form1.Visible = True
Text1.Text = ""
crlf = Chr$(13) + Chr$(10)
Open "\words\word.lst" For Input As #1
Do
Line Input #1, l$
If InStr(l, "j") > 0 And InStr(l, "q") > 0 Then Text1.Text = Text1.Text & l & crlf
Do
done = 1
For i = 1 To Len(l) - 1
If Mid(l, i + 1, 1) < "a" Or Mid(l, i + 1, 1) > "z" Then
l = Left(l, i) + Mid(l, i + 2)
Else
If Mid(l, i, 1) > Mid(l, i + 1, 1) Then
h$ = Mid(l, i, 1)
Mid(l, i, 1) = Mid(l, i + 1, 1)
Mid(l, i + 1, 1) = h
done = 0
ElseIf Mid(l, i, 1) = Mid(l, i + 1, 1) Then
l = Left(l, i) + Mid(l, i + 2)
End If
End If
Next
Loop Until done
For i = 1 To Len(l) - 1
s1 = InStr("abcdefghijklmnopqrstuvwxyz", Mid(l, i, 1))
For j = i + 1 To Len(l)
s2 = InStr("abcdefghijklmnopqrstuvwxyz", Mid(l, j, 1))
grid(s1, s2) = grid(s1, s2) + 1
Next
Next
Loop Until EOF(1)
Close 1
mn = 99999999
For i = 1 To 25
For j = i + 1 To 26
If grid(i, j) < mn Then mn = grid(i, j)
If grid(i, j) > mx Then mx = grid(i, j)
If grid(i, j) = 8 Or grid(i, j) = 76587 Then Text1.Text = Text1.Text & Mid("abcdefghijklmnopqrstuvwxyz", i, 1) & Mid("abcdefghijklmnopqrstuvwxyz", j, 1) & " "
Next
Next
Text1.Text = Text1.Text & crlf & mn & Str(mx) & crlf
Text1.Text = Text1.Text & crlf & " done"
End Sub