Back to task

465 symbols perl
Thu Apr 21 12:08:16 2016 megahallon
#!/usr/bin/perl
@i=map{chomp;substr$_,6}<>;sub l{length$_[0]}sub z{$p=$3//$1;$l=$1-$p+1;$p+=$l;substr$f[$_[0]],-$p,$l,++$n x$l}@f=map{' 'x l$_}@i[0,2];$m=qr/(\d+)(:(\d+))?/;while($i[1]=~/$m/g){z(0);$r.=substr$i[0],-$p,$l}$n=0;while($i[3]=~/$m/g){z(1);substr$i[2],-$p,$l,substr$r,$q,$l;$q+=$l}($p,$w)=map{s/(\d)\1*/$1.' 'x(l($&)-1)/ger=~s/\s+$//r}@f;($g,$h)=map{s#(\d)\1*#l($&)-1?'/'.'-'x(l($&)-2).'\\':'^'#ger=~s/\s+$//r}@f;print"From:\n$p\n$g\n$i[0]\n\n=$r\n\nTo:\n$w\n$h\n$i[2]";


Leave a comment

Parsed as Markdown

Login to leave a comment