See my answer after the original message. It uses Perl, but the minimum amount. It only took a few seconds to do it the natural way (natural if you are used to grep, comm and other Unix utilities). I used these utilities in part because Chris suggested their use, and in part because I think this is the quickest way to solve the problem in programmer time.
Steve -----Original Message----- From: Chris Devers [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 08, 2004 2:29 PM To: Boston Perl Mongers Subject: [Boston.pm] a car talk puzzle This seems like something that would be fun to solve with Perl: RAY: I have, written on a piece of paper in front of me, a word that is plural and also masculine. Now, I know we don't have masculine and feminine words in English the way we do in Italian or French. But, we do have words that connote masculinity. For example, the word "boys" is a plural word that connotes masculinity. The word I have written here is like "boys." It's masculine, and ends in "s." Not only that, but you change this word from plural to singular and from masculine to feminine, all by adding an "s" to it! I spent last night reading the entire Oxford English Dictionary, and I only found one example for which this works. Ok, so I've got a word list, how many words can there be that end in S? $ grep -ic 's$' /usr/share/dict/words 25998 Oy, way too many. But how many end in a double S? $ grep -ic 'ss$' /usr/share/dict/words 9552 Better, but not much better. If the word in question is in /usr/share/dict/words, then it should be one of the (hopefully) rare words that is a -ss word that, when the last -s is dropped, is also in the larger -s list. With luck, there will be only one; realistically, this should shorten the list enough that the answer can be found manually. Can anyone think of a clever way to do this ? -- Chris Devers _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pmHere Here is my deliberately non-clever solution. Note that I am running these Unix utilities in my DOS box; I got them from http://unxutils.sourceforge.net/ C:\wordlists>grep "ss$" words.txt > o1 C:\wordlists>grep "[^s]s" words.txt >o2 C:\wordlists>perl -ne "chomp; print $_ . qq(s\n)" o2 | sort > o3 C:\wordlists>comm -12 o1 o3 > o4 C:\wordlists>wc o4 5 5 30 o4 C:\wordlists>cat o4 ass buss canvass discuss hiss Oh well. It looks like my version of /usr/dict/words (which I named words.txt) did not have the answer. So I ran the same sequence of steps with a bigger word list, the yawl.lst (yet another word list) which is very large. It can be downloaded from http://personal.riverusers.com/~thegrendel/software.html and other places. C:\wordlists>grep "ss$" yawl.lst >o1 ... C:\wordlists>wc o4 127 127 1007 oo4 Eyeballing the list I come up with the following answer. Warning!! spoiler below, do not hit page down unless you want to see it millionairess Clearly "millionairess" is feminine and singular and I think that "millionaires" does have a masculine connotation. Hopefully helpfully yours, Steve -- Steve Tolkin Steve . Tolkin at FMR dot COM 617-563-0516 Fidelity Investments 82 Devonshire St. V4D Boston MA 02109 There is nothing so practical as a good theory. Comments are by me, not Fidelity Investments, its subsidiaries or affiliates. _______________________________________________ Boston-pm mailing list [EMAIL PROTECTED] http://mail.pm.org/mailman/listinfo/boston-pm

