The story this summer is those old style letter substitution puzzles like: S E N D + M O R E ========= M O N E Y The task is to figure out what digit each of the letters stands for. In the above example, if the letter "O" stands for zero, the letter "M" stands for one, "Y" for two, "E" for 5, "N" for 6, "D" for 7, "R" for 8, and "S" for 9 - then the substitutions make a valid addition problem with a correct answer. A solution is given by: SEND 9567 letter = S E N D M O R Y +MORE +1085 digit = 9 5 6 7 1 0 8 2 ===== ===== MONEY 10652 but you knew all this ... you asked for the details!!!! read on .... =============================================================================== DEADLINE IS 11:59PM on September 30, 1994 ... give or take a time zone! =============================================================================== 1. Your job is to write a program that takes three character strings as arguments. For example: progname SEND MORE MONEY The program should print out three numbers which result from making digit substitutions for the letters such that the sum of the first two numbers equals the third number. For example, the output of: 9567 1085 10652 would be a valid solution for the sample problem. There must be the same number of digits output as there are letters in the three arguments. 2. Your program will be run ten times, with ten different sets of three arguments - each set representing a valid addition problem. Scoring will be conducted as follows: a) one point for each valid solution (of the ten possible solutions) that is found. (0 to 10 points) b) in the event of a tie (likely), the first tiebreaker is computed by adding the ten sums from the ten problems - highest total wins. (This rewards large sums where a problem may have more than one solution. - the "sum" is the third argument) c) if still tied (likely), the smallest executable wins. Size of the executable is determined by an "ls -l" of the executable - which must be contained in a single file. (note that comment lines will be removed from shell entries before the computation ) d) if still tied .... nah, no chance! IMPORTANT: There IS a time constraint - the time constraint will be applied to the SYSTEM TEST problems (one minute per problem). When I run the finals, I will apply a less stringent time constraint and I will be unlikely to disqualify an entry unless it takes longer than an hour to complete the ten problems. The intent is to keep the runtimes "reasonable" - not to disqualify entries!! 3. About the problem: a) Three character strings will be presented to your program b) Each string will be composed of upper case (A-Z) letters c) Each string will be at least one letter long d) Each string will be 25 or fewer letters long e) No more than 10 different letters will be used in the three strings f) The three strings WILL represent a valid addition problem according to the rules of the puzzle - there is no need to deal with problems which have no solution. 4. About the answer: a) Three numbers will be output by your program b) all numbers are base 10 c) the first number plus the second should equal the third number d) the numbers should result from the substitution of the digits (0-9) for the letters in the three problem strings e) each letter represents a single digit (0-9) f) each letter represents a different digit (0-9) g) numbers with leading zeroes are NOT valid substitutions for any of the three strings 5. About your programming: a) C is the only compilable language acceptable - K&E C is best since I don't have an ANSI compiler ... sorry 'bout that! IMPORTANT: submit early so we can be sure there are no portability problems!!! b) if you wish to submit a shell program, Bourne, Korn, and csh are acceptable ... along with the following /bin tools: awk bc bdiff cat cmp cp csh cut dc diff diff3 echo ed egrep expr false fgrep grep head join ksh line ls more mv nawk paste rm sdiff sed sh sort split tail tee tr true uniq wc xargs PATH will be set such that ONLY these will be available - man pages available on request - but we're talking pretty standard tools here. (this approach may suit some of you because of the third tie-breaker, but please beware of the time constraint on ths system tests - read on!) c) Temporary files may be created in /tmp, but MUST be removed when you are done ... creation of files anywhere else is strictly prohibited. 6. The system testing .... a) ship me an entry as soon as possible - you can always submit another entry if you improve your solution .. b) on receipt of your entry, I'll run my system test to make sure your program works ... you'll receive the results and a weekly standing of how you fared against other entries! c) here are the system test problems: SEND MORE MONEY NO WAY BOB ABCABCABCABCABCABCABC DEFDEFDEFDEFDEFDEFDEF GHIGHIGHIGHIGHIGHIGHI THE POTM RULES FIVE FOUR NINE they all have at least one solution - trust me! d) your program must solve these five problems in no more than five minutes ... I will be reasonable, but will not allow you to go significantly above five minutes (sys+user time as measured by timex summed over the five system test executions). Your time will be provided along with your system test run. 7. SENDING ME YOUR ENTRY - PLEASE USE EMAIL!!! Please email me the source code to me at: fah@potm.ffast.att.com (preferred) attmail!hicinbothem (will forward correctly) IMPORTANT: Please use the following (or equivalent) lines at the front of the program you mail to me (this will help immeasurably!): /* POTM ENTRY: entryname (something clever please! */ /* Your Name: First Last */ /* Your email: log@machine.att.com (or whatever) */ /* compilation instructions (if other than "make entryname") */ NOTE: If you submit a shell program, please include these lines with a leading "#" and indicate which shell to run it under! These lines will not be included in your program size count. IMPORTANT: ENTER EARLY - you will receive weekly standings and you will resolve any portability issues early. You may improve your entry at any time by simply sending me another entry - so it pays to enter earlier! IMPORTANT: AFTER you mail me an entry, I will run a system test on it and ship you the results - the system test results comprise the weekly standings. IMPORTANT: If you don't hear from me within a few days - it may mean that the mail got screwed up .... please follow up with an inquiry to attmail!hicinbothem .... hopefully all the bugs are worked out! Thanks! Looking forward to your entry. If you have any questions, mail 'em to me - if I answer them I'll include them in the Frequently Asked Questions (FAQ) list I circulate with the weekly standings!!! =Fred