<>;\x0d while(<>){\x0d \x0d chomp;\x0d @m = split/ /;\x0d # print"@m\n";\x0d \x0d @eil = ();\x0d @mas = ();\x0d \x0d sub make{\x0d # print ": (@_)\n";\x0d for (0..@_-1){\x0d # print " $_ ::\n";\x0d my @a = @_;\x0d $p = splice(@a,$_,1);\x0d # print" $p\n";\x0d # print " :: (@a)\n";\x0d push @eil, $p;\x0d @a and make(@a);\x0d if (!@a){\x0d # print " \@eil : @eil\n";\x0d # print "@eil\n";\x0d $e = join"",@eil;\x0d splice (@mas,@mas,0,$e);\x0d } \x0d pop @eil;\x0d # print " ::: (@a)\n";\x0d }\x0d }\x0d \x0d make(@m);\x0d # print "@mas\n";\x0d \x0d $max = undef;\x0d for (@mas){\x0d $diff = $_ - reverse $_ ;\x0d # print "$diff\n";\x0d defined $max or $max = $diff;\x0d $diff > $max and $max = $diff;\x0d # print "$max\n";\x0d \x0d }\x0d print "$max\n";\x0d }
Note that non-ascii characters in the above source code will be escaped (such as \x9f).