A word frame puzzle is a new twist on the classic word search puzzle. In a word frame puzzle, the hidden words are arranged in a rectangular frame, reather than in a single straight line. Consider the two sample word frame puzzles below:
REPRESENTATIVE -->
PAINTERS |
The solver must locate words from a given wordlist hidden in the puzzle diagram in the form of a rectangular frame parallel to the sides of the puzzle (a word frame). Only words appearing in the puzzle in a word frame count (finding the letters of a word in a straight line or in any other rectilinear pattern is not considered to be the discovery of a hidden word). Word frames may be nested or overlap within a puzzle. Once all word frames have been located and all words not appearing in the puzzle have been discarded, the frozen letters letters that are not part of any word block) must be indicated on a line-by-line basis. Note that any letters surrounded by a word frame are also considered frozen unless they are part of some other word block. Write a program that will solve word frame puzzles.
QUNJOIPPCHYQUEN PLOZZNYJACNETOT SCILLTHOCHEMIXS GRSSESPSWAIRTHC TOXEWLLMJLCOSNO OTANSQUAKETDIZL ROLXYBBEXRYCJPG LJSOIXOPSSACILM EGIASTLICVNOOBY PETMANITIFREPUG RESEXECOLOUTEMO PAINDMOCIBUSDRC EXATOMISHSJITAR RHRAWIBEOSENIBB EVITWTTEMMRGDEW 20 POLITICS AMENDMENTS BUSINESS COMMETTEES DISTRICT CONSTITUENTS DEBATING TABLED DEMOCRAT FILIBUSTER JOINTSESSION SPEAKERS LOBBYIST MAKELAWS PRESTIGE REPRESENTATIVE CHAIRMEN REPUBLICAN SENATORS LEGISLATOR RIHCRNERBRAINTE OOFEONYOUINAPSR PRACTTALKCCHIRO RSLANTORSMECIAN UERTSCARPODICAB NSPLYODLACITUAE ARFUSNEISTPAREL EEBMEGRRKOOBBUT SERSAIETAIDREEL IARPPNEMSTRIKSO ACPASTBARBETANR OSERREPESSSSMUS URNABARENNUSROC RETROOKKGORJETA FOOREFATIEGANIT 25 CARPENTERS JANITORS APPRAISERS PROFESSORS SURGEONS PLUMBERS BARBER CONSULTANT MECHANIC ROOFER BARTENDERS BEAUTICIAN NURSES ENGINEER SEAMSTRESS ATTORNEY BRICKLAYER MEDICALDOCTORS PODIATRIST BOOKKEEPER DRESSMAKER PAINTERS COUNSELORS BUTLER CHIROPRACTOR
---Results of Puzzle #1--- TABLED - not found Frozen Letters in Row # 1: QUPPCHYQ Frozen Letters in Row # 2: PLZZYJAO Frozen Letters in Row # 3: SCLLHOCEX Frozen Letters in Row # 4: GPH Frozen Letters in Row # 5: TXWLLJO Frozen Letters in Row # 6: SQUZL Frozen Letters in Row # 7: OXXYCJPH Frozen Letters in Row # 8: JOXM Frozen Letters in Row # 9: IVOOY Frozen Letters in Row #10: EAG Frozen Letters in Row #11: XCOOU Frozen Letters in Row #12: AIR Frozen Letters in Row #13: XAOIHJ Frozen Letters in Row #14: HRWBOIB Frozen Letters in Row #15: WMMRW ---Results of Puzzle #1--- PROFESSORS - not found BARTENDERS - not found Frozen Letters in Row # 1: A Frozen Letters in Row # 2: OFENOU Frozen Letters in Row # 3: CIRO Frozen Letters in Row # 4: L Frozen Letters in Row # 5: RSARPOCA Frozen Letters in Row # 6: Y Frozen Letters in Row # 7: AF Frozen Letters in Row # 8: EEKO Frozen Letters in Row # 9: Frozen Letters in Row #10: I Frozen Letters in Row #11: AASTBRBT Frozen Letters in Row #12: OR Frozen Letters in Row #13: UAARN Frozen Letters in Row #14: RGEA Frozen Letters in Row #15: FOOATIT