31 lines
1.7 KiB
Plaintext
31 lines
1.7 KiB
Plaintext
Public Sub Main()
|
|
Dim sDict As String = File.Load(User.Home &/ "unixdict.txt") 'Store the 'Dictionary'
|
|
Dim sOrdered As New String[] 'To store ordered words
|
|
Dim sHold As New String[] 'General store
|
|
Dim sTemp As String 'Temp variable
|
|
Dim siCount As Short 'Counter
|
|
|
|
For Each sTemp In Split(sDict, gb.NewLine) 'For each word in the Dictionary
|
|
For siCount = 1 To Len(sTemp) 'Loop for each letter in the word
|
|
sHold.Add(Mid(sTemp, siCount, 1)) 'Put each letter in sHold array
|
|
Next
|
|
sHold.Sort() 'Sort sHold (abbott = abboot, zoom = mooz)
|
|
If sTemp = sHold.Join("") Then sOrdered.Add(sTemp) 'If they are the same (abbott(OK) mooz(not OK)) then add to sOrdered
|
|
sHold.Clear 'Empty sHold
|
|
Next
|
|
|
|
siCount = 0 'Reset siCount
|
|
|
|
For Each sTemp In sOrdered 'For each of the Ordered words
|
|
If Len(sTemp) > siCount Then siCount = Len(sTemp) 'Count the length of the word and keep a record of the longest length
|
|
Next
|
|
|
|
For Each sTemp In sOrdered 'For each of the Ordered words
|
|
If Len(sTemp) = siCount Then sHold.Add(sTemp) 'If it is one of the longest add it to sHold
|
|
Next
|
|
|
|
sHold.Sort() 'Sort sHold
|
|
Print sHold.Join(gb.NewLine) 'Display the result
|
|
|
|
End
|