<!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 #21</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=2>IMPORTANT: Please do not post solutions, hints, or other spoilers</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; until at least 60 hours after the date of this message.</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thanks.</FONT>
</P>

<P><FONT SIZE=2>IMPORTANTE: Por favor, no enviis soluciones, pistas, o cualquier otra</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cosa que pueda echar a perder la resolucin del problema hasta</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; que hayan pasado por lo menos 60 horas desde el envo de este</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mensaje. Gracias.</FONT>
</P>

<P><FONT SIZE=2>IMPORTANT: S'il vous plat, attendez au minimum 60 heures aprs la</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; date de ce message avant de poster solutions, indices ou autres</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rvlations. Merci.</FONT>
</P>

<P><FONT SIZE=2>Qing3 Zhu4Yi4: Qing3 Ning2 Deng3Dao4 Jie1Dao4 Ben3 Xin4Xi2 Zhi1Hou4 60</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Xiao3Shi2, Zai4 Fa1Biao3 Jie3Da2, Ti2Shi4, Huo4 Qi2Ta1 Hui4</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Xie4Lou4 Da2An4 De5 Jian4Yi4.&nbsp; Xie4Xie4.</FONT>
</P>

<P><FONT SIZE=2>UWAGA: Prosimy nie publikowac rozwiazan, dodatkowych&nbsp; badz pomocniczych</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>informacjii przez co najmniej 60 godzin od daty tej wiadomosci.</FONT>
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2>Dziekuje.</FONT>
</P>

<P><FONT SIZE=2>----------------------------------------------------------------</FONT>
</P>

<P><FONT SIZE=2>In the 1960's, the grad students at the University of Chicago math department worked on a series of astoundingly useless and time-consuming puzzles.&nbsp; One of these follows.&nbsp; Consider the set of all possible strings of the alphabet ('a' .. 'z').&nbsp; Let us agree to consider two strings &quot;equivalent&quot; if the following conditions hold:</FONT></P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1. They contain precisely the same letters, and</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2. They both appear in Webster's Third International Dictionary.</FONT>
</P>

<P><FONT SIZE=2>In such a case, the two strings are considered interchangeable in all contexts.&nbsp; For example, &quot;am&quot; and &quot;ma&quot; are equivalent, and this also implies that &quot;amount&quot; and &quot;maount&quot; are equivalent, as are &quot;grammar&quot;</FONT></P>

<P><FONT SIZE=2>and &quot;grmamar&quot; and &quot;gramamr&quot; and &quot;grmaamr&quot;.</FONT>
</P>

<P><FONT SIZE=2>Moreover, equal letters can be cancelled from the front and back end of any string.&nbsp; For example, &quot;abby&quot; and &quot;baby&quot; are equivalent, and, cancelling the trailing &quot;by&quot;, this implies that &quot;ab&quot; and &quot;ba&quot; are also equivalent, and can be exchanged anywhere.&nbsp; When two letters can be exchanged in this way, we say that they &quot;commute&quot;.&nbsp; The third floor of the math building at UC had a huge 26x26 chart; the square in column i and row j contained a proof that letters i and j would commute.</FONT></P>

<P><FONT SIZE=2>Sometimes these proofs can be rather elaborate.&nbsp; For example, the dictionary has &quot;dire&quot; and &quot;ride&quot;, so, by cancelling the trailing &quot;e&quot;s, one has &quot;dir&quot; = &quot;rid&quot;.</FONT></P>

<P><FONT SIZE=2>The dictionary also has</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dirten = rident</FONT>
</P>

<P><FONT SIZE=2>(No, I don't know what those mean.)&nbsp; Since &quot;dir&quot; = &quot;rid&quot; we have:</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rident = dirent</FONT>
</P>

<P><FONT SIZE=2>and since &quot;rident&quot; = &quot;dirten&quot;, </FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dirten = dirent</FONT>
</P>

<P><FONT SIZE=2>even though &quot;dirent&quot; is not a dictionary word. Cancelling the leading &quot;dir&quot; leaves:</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ten =&nbsp;&nbsp;&nbsp; ent</FONT>
</P>

<P><FONT SIZE=2>but</FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ten =&nbsp;&nbsp;&nbsp; net</FONT>
</P>

<P><FONT SIZE=2>because &quot;ten&quot; and &quot;net&quot; are dictionary words, so</FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ent =&nbsp;&nbsp;&nbsp; net</FONT>
</P>

<P><FONT SIZE=2>and, cancelling the &quot;t&quot;, </FONT>
</P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; en&nbsp; =&nbsp;&nbsp;&nbsp; ne</FONT>
</P>

<P><FONT SIZE=2>and we've just proved that &quot;en&quot; and &quot;ne&quot; commute.&nbsp; This fact might be useful in later proofs.</FONT>
</P>

<P><FONT SIZE=2>What's the point of all this?&nbsp; Well, the goal is to find out which letters commute with *every* other letter; such letters are said to be in the &quot;center&quot; of the system.&nbsp; As for the *point*, I'm not sure there is one.&nbsp; Apparently the math grads at UC didn't have enough to occupy their time.</FONT></P>

<P><FONT SIZE=2>The chart in the UC math building has since been lost, so your task is to write a program whose input is a word list, with one word per line, and which makes appropriate deductions and eventually computes the center of the system.&nbsp; I don't have the headword list from Webster's Third, but I do have the list from Webster's Second, so let's use that.&nbsp; You can get a copy from</FONT></P>

<P><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A HREF="http://perl.plover.com/qotw/words/Web2.bz2" TARGET="_blank">http://perl.plover.com/qotw/words/Web2.bz2</A></FONT>
<BR><FONT SIZE=2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A HREF="http://perl.plover.com/qotw/words/Web2.gz" TARGET="_blank">http://perl.plover.com/qotw/words/Web2.gz</A></FONT>
</P>
<BR>
<BR>
<BR>
<BR>

</BODY>
</HTML>