perl -pe '@h{a..z}=1;s/\d/(%h)[$&*2]/eg' input.txt