use strict; use warnings; use utf8; print '/* XPM */ static char *APES[] = { "100 100 7 1", ". c #ffffff", "a c #999999", "3 c #0000ff", "4 c #0099ff", "f c #00cc00", "b c #996633", "p c #ff00ff'; for $_ (1..10_000) { print "\",\n\"" if $_ % 100 == 1; my $s = join '', sort {$a cmp $b} split //, $_; if($s =~ /(\d)\1{3}/) { # fourthers print "4"; } elsif($s =~ /(\d)\1{2}/) { # feathers print "3"; } elsif($_ eq reverse) { # paldenorm print "p"; } elsif(/^(\d).*\1$/) { # bookends print "b"; } elsif($s =~ /(\d)\1.*(\d)\2/) { # frog print "f"; } elsif($s =~ /(\d)\1/) { # ape print "a"; } else { print "."; } } print '" }; ';