
I've been testing the solutions that folks have sent so far against
output generated by my own solution.  They don't always agree, but
when I hand-check the disagreements, mine appear to be correct.

Here are some sample data that might be considered 'difficult' because
the solutions presented so far don't all get them correct.

The first column is (I believe) the correct minimum number of chunks.
Please let me know if any of this test data is incorrect.

3 bade bead
4 glare lager
8 precipitate peripatetic
4 prefect perfect
4 trout tutor
4 alarm lamar
4 assist stasis
3 egret greet
4 virgin irving
3 ramada armada

Here's the test module I've been using.  Put the test data in a file
called 'words.as', put the test module in a file called ScoreTest.pm,
and then use

        perl -MScoreTest yourprogram.pl

When your program finishes running, ScoreTest will take over and test
your min_chunks function.


        package Scoretest;
        my $testfile = $ENV{ANAGRAM_SCORES} || 'words.as';

        END {
          print "1..1\n";
          open F, "<", $testfile or die $!;
          while (<F>) {
            chomp;
            my ($s, $w1, $w2) = split;
            my $as = main::min_chunks($w1, $w2);
            if ($as != $s) {
              print "not ok $. # ($w1, $w2) was $as, should be  $s\n";
              $NOTOK++;
            } else {
        #      print "ok $.\n";
            }
          }
          if ($NOTOK) {
            print STDERR "not ok # $NOTOK failures?\n";
          } else {
            print STDERR "ok\n";
          }
        }

        1;

