All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > General > Word Problems
Ten Words (3) (Posted on 2004-09-05) Difficulty: 3 of 5
Ten nine-letter words have been separated into units of three letters. The units have been randomly put in the below list. Can you determine the original 10 words?

   rec rar ant htn fer ort
   ent cer por sin lig ian
   lio row use tfo eth ive
   sca ing ing lib ely dig
   som dif far est imp mho

See The Solution Submitted by SilverKnight    
Rating: 2.6667 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Program solution | Comment 4 of 14 |
The VB program listed below ran in 22 seconds (!!) to produce the following results:
 
In my 354,530 unabridged and expanded word list, there are a total of 24 words formed by the 30 syllables:
 
different  differing  digestant  digesting  digestive  farmhouse  farrowing impingent impinging  important importing  imprecant  ingesting  ingestive  ingrowing librarian  lightning  portfolio  recanting  recentest  scarecrow  sincerely sincerest  something
 
There is only one valid group of 10 of them, and that is the puzzle solution:
 
different  digestive  farmhouse  important librarian  lightning  portfolio scarecrow  sincerely something
 
 
Program used:
 
Imports System
Imports System.IO
Imports System.Text
Imports System.Runtime.InteropServices
Imports System.Math
Module Module1
    Sub Main()
        Randomize()
        Dim strstarttime As String
        Dim strendtime As String
        Dim strend As String
        Dim intloop1 As Integer = 359999
        Dim intloop2 As Integer = 29
        Dim intloop3 As Integer = 99
        Dim strsylbs(30) As String
        Dim strwords(360000) As String
        Dim stranspool(100) As String
        Dim intloop4 As Integer = 99
        Dim intcount As Integer = 0
        strstarttime = TimeOfDay
        Console.WriteLine( _
        TimeOfDay & ": Start of execution.")
        For index1 As Integer = 0 To intloop4
            stranspool(index1) = " "
        Next
        readfileintotable(intloop1, intloop2, strwords)
        strsylbs(0) = "rec"
        strsylbs(1) = "rar"
        strsylbs(2) = "ant"
        strsylbs(3) = "htn"
        strsylbs(4) = "fer"
        strsylbs(5) = "ort"
        strsylbs(6) = "ent"
        strsylbs(7) = "cer"
        strsylbs(8) = "por"
        strsylbs(9) = "sin"
        strsylbs(10) = "lig"
        strsylbs(11) = "ian"
        strsylbs(12) = "lio"
        strsylbs(13) = "row"
        strsylbs(14) = "use"
        strsylbs(15) = "tfo"
        strsylbs(16) = "eth"
        strsylbs(17) = "ive"
        strsylbs(18) = "sca"
        strsylbs(19) = "ing"
        strsylbs(20) = "ing"
        strsylbs(21) = "lib"
        strsylbs(22) = "ely"
        strsylbs(23) = "dig"
        strsylbs(24) = "som"
        strsylbs(25) = "dif"
        strsylbs(26) = "far"
        strsylbs(27) = "est"
        strsylbs(28) = "imp"
        strsylbs(29) = "mho"
        intloop1 = intloop2
        Console.WriteLine( _
        "Loop limit reset to " & Str(intloop1))
        strendtime = TimeOfDay
        findthewords(strwords, intloop1, strsylbs, _
        stranspool, intloop4, intcount)
        intloop4 = intcount
        Console.WriteLine(Str(intloop4 + 1) & " words found")
        For index1 As Integer = 0 To intloop4
            Console.WriteLine(stranspool(index1))
        Next
        findcombos(stranspool, intloop4, strsylbs)
        Console.WriteLine(" ")
        Console.WriteLine("Start of execution: " & strstarttime)
        strendtime = TimeOfDay
        Console.WriteLine( _
        TimeOfDay & ": End of execution.")
        strend = "?"
        Console.WriteLine(" ")
        While strend <> "x"
            Console.WriteLine( _
            "Please enter X to exit program.")
            strend = LCase(Console.ReadLine())
        End While
    End Sub

    Sub readfileintotable(ByRef intloop1, ByRef intloop2, _
    ByRef strwords)
        Dim intsub1 As Integer
        Dim strline As String
        Dim strerrorflag As String
        Dim intreccount As Integer
        Dim objStreamReader As StreamReader
        For index1 As Integer = 0 To intloop1
            strwords(index1) = " "
        Next
        intreccount = 0
        intsub1 = 0
        intreccount = 0
        Console.WriteLine( _
        TimeOfDay & ": Reading the sorted wordlist file...")
        strline = " "
        objStreamReader = _
        New StreamReader("C:VBWORDLIST.MASTER")
        strerrorflag = "n"
        Do While Not strline Is Nothing
            strline = objStreamReader.ReadLine
            If strline <= " " Then
                Exit Do
            End If
            If intsub1 <= intloop1 Then
                putintable(strline, intloop1, intloop2, _
                intsub1, strwords, intreccount)
            Else
                strerrorflag = "y"
            End If
        Loop
        objStreamReader.Close()
        If strerrorflag = "n" Then
            Console.WriteLine( _
            TimeOfDay & ": Done. " & Str(intreccount) & _
            " records read.")
        Else
            Console.WriteLine(TimeOfDay & _
            "ERROR !!!! Please increase table size")
            Console.ReadLine()
            End
        End If
    End Sub

    Sub putintable(ByRef strline, ByRef intloop1, _
    ByRef intloop2, ByRef intsub1, ByRef strwords, _
    ByRef intreccount)
        Dim strwork(100) As String
        Dim strstring As String
        Dim intsub2 As Integer
        Dim intlettercount As Integer
        intsub2 = 0
        For index1 As Integer = 0 To 99
            strwork(index1) = " "
        Next
        strstring = LCase(strline)
        strline = strstring
        For index1 As Integer = 1 To Len(strline)
            If (Mid(strline, index1, 1) >= "a" And _
            Mid(strline, index1, 1) <= "z") Then
                intlettercount += 1
                strwork(intsub2) = Mid(strline, index1, 1)
                intsub2 += 1
            End If
        Next
        strline = ""
        For index1 As Integer = 0 To 99
            If strwork(index1) = " " Then
                Exit For
            End If
            strline &= strwork(index1)
        Next
        strwords(intsub1) = strline
        intloop2 = intsub1
        intsub1 += 1
        intreccount += 1
    End Sub

    Sub findthewords(ByRef strwords, ByRef intloop1, _
    ByRef strsylbs, ByRef stranspool, ByRef intloop4, _
    ByRef intcount)
        Dim str1 As String
        Dim str2 As String
        Dim str3 As String
        Dim strword As String
        Dim strhit As String
        For index1 As Integer = 0 To intloop1
            If Len(strwords(index1)) = 9 Then
                strword = strwords(index1)
                parseword(strword, _
                str1, str2, str3)
                For index6 As Integer = 0 To 29
                    If strsylbs(index6) = str1 Then
                        For index7 As Integer = 0 To 29
                            If strsylbs(index7) = str2 Then
                                For index8 As Integer = 0 To 29
                                    If strsylbs(index8) = str3 Then
                                        placeinpool(str1, str2, _
                                        str3, stranspool, intloop4, _
                                        intcount)
                                    End If
                                Next
                            End If
                        Next
                    End If
                Next
            End If
        Next
    End Sub

    Sub placeinpool(ByRef str1st, ByRef str2nd, _
    ByRef str3rd, ByRef stranspool, ByRef intloop4, _
    ByRef intcount)
        Dim strwordnow As String
        strwordnow = str1st & str2nd & str3rd
        If stranspool(intloop4) <> " " Then
            Console.WriteLine("Please increase " & _
            "answer pool size.")
            Console.ReadLine()
            End
        End If
        For index1 As Integer = 0 To intloop4
            If stranspool(index1) = strwordnow Then
                Exit Sub
            ElseIf stranspool(index1) = " " Then
                stranspool(index1) = _
                str1st & str2nd & str3rd
                intcount = index1
                Exit Sub
            End If
        Next
    End Sub

    Sub findcombos(ByRef stranspool, ByRef intloop4, _
    ByRef strsylbs)
        Dim strflag As String
        Dim strword111(10) As String
        Dim intwordloop As Integer
        For index1 As Integer = 0 To intloop4 - 9
            strword111(0) = stranspool(index1)
            For index2 As Integer = index1 + 1 To intloop4 - 8
                strword111(1) = stranspool(index2)
                intwordloop = 1
                strcombocheck(strflag, _
                strword111, intwordloop, _
                strsylbs)
                If strflag = "y" Then
                    For index3 As Integer = index2 + 1 To intloop4 - 7
                        strword111(2) = stranspool(index3)
                        intwordloop = 2
                        strcombocheck(strflag, _
                        strword111, intwordloop, _
                        strsylbs)
                        If strflag = "y" Then
                            findcombos2(stranspool, intloop4, _
                            strsylbs, strword111, _
                            index1, index2, index3)
                        End If
                    Next
                End If
            Next
        Next
    End Sub

    Sub findcombos2(ByRef stranspool, ByRef intloop4, _
    ByRef strsylbs, ByRef strword111, _
    ByRef index1, ByRef index2, ByRef index3)
        Dim strflag As String
        Dim intwordloop As Integer
        For index4 As Integer = index3 + 1 To intloop4 - 6
            strword111(3) = stranspool(index4)
            intwordloop = 3
            strcombocheck(strflag, _
                        strword111, intwordloop, _
                        strsylbs)
            If strflag = "y" Then
                For index5 As Integer = index4 + 1 To intloop4 - 5
                    strword111(4) = stranspool(index5)
                    intwordloop = 4
                    strcombocheck(strflag, _
                    strword111, intwordloop, _
                    strsylbs)
                    If strflag = "y" Then
                        For index6 As Integer = index5 + 1 To intloop4 - 4
                            strword111(5) = stranspool(index6)
                            intwordloop = 5
                            strcombocheck(strflag, _
                            strword111, intwordloop, _
                            strsylbs)
                            If strflag = "y" Then
                                findcombos3(stranspool, intloop4, strsylbs, _
                                strword111, _
                                index1, index2, index3, _
                                index4, index5, index6)
                            End If
                        Next
                    End If
                Next
            End If
        Next
    End Sub

    Sub findcombos3(ByRef stranspool, ByRef intloop4, _
    ByRef strsylbs, ByRef strword111, _
    ByRef index1, ByRef index2, ByRef index3, _
    ByRef index4, ByRef index5, ByRef index6)
        Dim strflag As String
        Dim intwordloop As Integer
        For index7 As Integer = index6 + 1 To intloop4 - 3
            strword111(6) = stranspool(index7)
            intwordloop = 6
            strcombocheck(strflag, _
                        strword111, intwordloop, _
                        strsylbs)
            If strflag = "y" Then
                For index8 As Integer = index7 + 1 To intloop4 - 2
                    strword111(7) = stranspool(index8)
                    intwordloop = 7
                    strcombocheck(strflag, _
                    strword111, intwordloop, _
                    strsylbs)
                    If strflag = "y" Then
                        For index9 As Integer = index8 + 1 To intloop4 - 1
                            strword111(8) = stranspool(index9)
                            intwordloop = 8
                            strcombocheck(strflag, _
                            strword111, intwordloop, _
                            strsylbs)
                            If strflag = "y" Then
                                findcombos4(stranspool, intloop4, strsylbs, _
                                strword111, _
                                index1, index2, index3, _
                                index4, index5, index6, _
                                index7, index8, index9)
                            End If
                        Next
                    End If
                Next
            End If
        Next
    End Sub

    Sub findcombos4(ByRef stranspool, ByRef intloop4, _
    ByRef strsylbs, ByVal strword111, _
    ByRef index1, ByRef index2, ByRef index3, _
    ByRef index4, ByRef index5, ByRef index6, _
    ByRef index7, ByRef index8, ByRef index9)
        Dim intwordloop As Integer
        Dim strflag As String
        For index10 As Integer = index9 + 1 To intloop4
            strword111(9) = stranspool(index10)
            intwordloop = 9
            strcombocheck(strflag, _
                        strword111, intwordloop, _
                        strsylbs)
            If strflag = "y" Then
                Console.WriteLine(" ")
                Console.WriteLine( _
                "Here is a valid combination of 10 words:")
                For index99 As Integer = 0 To 9
                    Console.WriteLine(strword111(index99))
                Next
            End If
        Next
    End Sub

    Sub strcombocheck(ByRef strflag, _
    ByRef strword111, ByRef intwordloop, _
    ByRef strsylbs)
        Dim str1 As String
        Dim str2 As String
        Dim str3 As String
        Dim strword As String
        Dim strwork(9) As String
        Dim strtemp(30) As String
        Dim strtemp2(10) As String
        strflag = "n"
        For index1 As Integer = 0 To 29
            strtemp(index1) = strsylbs(index1)
        Next
        For index1 As Integer = 0 To 9
            strtemp2(index1) = strword111(index1)
        Next
        For index1 As Integer = 0 To intwordloop
            If strtemp2(index1) <> " " Then
                parseword(strtemp2(index1), _
                str1, str2, str3)
                For index2 As Integer = 0 To 29
                    If str1 = strtemp(index2) Then
                        str1 = " "
                        strtemp(index2) = " "
                    End If
                    If str2 = strtemp(index2) Then
                        str2 = " "
                        strtemp(index2) = " "
                    End If
                    If str3 = strtemp(index2) Then
                        str3 = " "
                        strtemp(index2) = " "
                    End If
                Next
                If str1 = " " And str2 = " " And str3 = " " Then
                    strtemp2(index1) = " "
                End If
            End If
        Next
        For index1 As Integer = 0 To intwordloop
            If strtemp2(index1) <> " " Then
                Exit Sub
            End If
        Next
        strflag = "y"
    End Sub

    Sub parseword(ByRef strword, _
    ByRef str1, ByRef str2, ByRef str3)
        Dim strwork(9) As String
        For index1 As Integer = 1 To Len(strword)
            strwork(index1 - 1) = Mid(strword, index1, 1)
        Next
        str1 = ""
        str2 = ""
        str3 = ""
        For index3 As Integer = 0 To 2
            str1 &= strwork(index3)
        Next
        For index4 As Integer = 3 To 5
            str2 &= strwork(index4)
        Next
        For index5 As Integer = 6 To 8
            str3 &= strwork(index5)
        Next
    End Sub
End Module
 
 

 

Edited on September 6, 2004, 7:48 am
  Posted by Penny on 2004-09-05 17:01:15

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (13)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information