say $!=get;say m/K/??.subst('K','R'x$!.index("T")-$/.from+1)!!$! for lines