<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2657.73">
<TITLE>Perl 'Expert' Quiz-of-the-Week #22</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>IMPORTANT: Please do not post solutions, hints, or other spoilers</FONT>
<BR><FONT SIZE=2> until at least 60 hours after the date of this message.</FONT>
<BR><FONT SIZE=2> Thanks.</FONT>
</P>
<P><FONT SIZE=2>IMPORTANT: S'il vous plat, attendez au minimum 60 heures aprs la</FONT>
<BR><FONT SIZE=2> date de ce message avant de poster solutions, indices ou autres</FONT>
<BR><FONT SIZE=2> rvlations. Merci.</FONT>
</P>
<P><FONT SIZE=2>BELANGRIJK: Stuur aub geen oplossingen, hints of andere tips in de</FONT>
<BR><FONT SIZE=2> eerste 60 uur na het verzendingstijdstip van dit</FONT>
<BR><FONT SIZE=2> bericht. Waarvoor dank.</FONT>
</P>
<P><FONT SIZE=2>Qing3 Zhu4Yi4: Qing3 Ning2 Deng3Dao4 Jie1Dao4 Ben3 Xin4Xi2 Zhi1Hou4 60</FONT>
<BR><FONT SIZE=2> Xiao3Shi2, Zai4 Fa1Biao3 Jie3Da2, Ti2Shi4, Huo4 Qi2Ta1 Hui4</FONT>
<BR><FONT SIZE=2> Xie4Lou4 Da2An4 De5 Jian4Yi4. Xie4Xie4.</FONT>
</P>
<P><FONT SIZE=2>----------------------------------------------------------------</FONT>
</P>
<P><FONT SIZE=2>Write a program, 'wordladder', which gets two arguments, which are words of the same length, and which constructs and prints a "word ladder" from the first word to the second word.</FONT></P>
<P><FONT SIZE=2>A word ladder from word AAA to word BBB is a sequence of dictionary words such that:</FONT>
</P>
<P><FONT SIZE=2>1. the first word in the sequence is word AAA 2. each word in the sequence after the first differs from the previous</FONT>
<BR><FONT SIZE=2> word in exactly one letter position</FONT>
<BR><FONT SIZE=2>3. the last word in the sequence is word BBB</FONT>
</P>
<P><FONT SIZE=2>For example, given the two words "love" and "hate", the program might print the word ladder:</FONT>
</P>
<P><FONT SIZE=2> love</FONT>
<BR><FONT SIZE=2> hove</FONT>
<BR><FONT SIZE=2> have</FONT>
<BR><FONT SIZE=2> hate</FONT>
</P>
<P><FONT SIZE=2>Or it might print:</FONT>
</P>
<P><FONT SIZE=2> love</FONT>
<BR><FONT SIZE=2> lave</FONT>
<BR><FONT SIZE=2> have</FONT>
<BR><FONT SIZE=2> hate</FONT>
</P>
<P><FONT SIZE=2>It might also print a longer word ladder, such as</FONT>
</P>
<P><FONT SIZE=2> love</FONT>
<BR><FONT SIZE=2> lore</FONT>
<BR><FONT SIZE=2> lobe</FONT>
<BR><FONT SIZE=2> robe</FONT>
<BR><FONT SIZE=2> role</FONT>
<BR><FONT SIZE=2> rose</FONT>
<BR><FONT SIZE=2> lose</FONT>
<BR><FONT SIZE=2> lost</FONT>
<BR><FONT SIZE=2> most</FONT>
<BR><FONT SIZE=2> mosh</FONT>
<BR><FONT SIZE=2> moth</FONT>
<BR><FONT SIZE=2> math</FONT>
<BR><FONT SIZE=2> hath</FONT>
<BR><FONT SIZE=2> hate</FONT>
</P>
<P><FONT SIZE=2>If the program is unable to find a word ladder, it should print an appropriate error message to the standard error, and exit with a failure status.</FONT></P>
<P><FONT SIZE=2>The program should also accept an optional third argument, which, if specified, is the name of a dictionary file which contains the permissible words. If the third argument is omitted, the program should use a default dictionary.</FONT></P>
<P><FONT SIZE=2>Sample word lists are available from</FONT>
<BR><FONT SIZE=2> <A HREF="http://perl.plover.com/qotw/words/" TARGET="_blank">http://perl.plover.com/qotw/words/</A></FONT>
</P>
</BODY>
</HTML>