Back to task

463 symbols bash
Fri Aug 12 23:51:24 2016 hidefromkgb
g()(rev<<<"$1"|fold -w1)
h()(p=${@: -1};k=(`yes _|head -${#p}`);p=(${k[@]});l=(`g $3`);r=(`g $2`)
for x in ${1//,/ };do n=${x#*:};x=m=${x%:*};k[$x]=$[++j]
while((m>=n));do p[$m]=-;l[$[${#3}?m--:y++]]=${r[$[${#3}?y++:m--]]};done
p[$x]=\/;p[$n]=^;((n<x))&&p[$n]=\\
done;rev<<<${k[@]}$'\n'${p[@]}$'\n'${l[@]}|sed 's/ //g;y/_/ /;s/ *$//')
read -d $'\4' s i d o<<<`tr -d \ |cut -d: -f2-`
i=`h $i $s`;e=${i##*$'\n'};echo "From:
${i%$e}$s

=`rev<<<$e`

To:
`h $o $e $d`"


Leave a comment

Parsed as Markdown

Login to leave a comment