#!/usr/local/bin/perl5 -ws
@A[@W]=@W=($X=$Y=$U=0)..255;map{@A[$_,$U]=($A[$U=($U+ord((split//,$k)[$_%length
$k])+($t=$A[$_]))&255],$t)}@W;while(<STDIN>){map{@A[$X=$x,$Y=$y]=($T=$A[$y=(($S
=$A[$x=++$X&255])+$Y)&255],$S);print chr(ord^$A[($S+$T)&255])}split//}
