by@coil_kpc
AC
1339ms
my $s=get;$s.say;my $k=.index('K'),say $k??.subst('K','R'x$s.index("T")-$k+1)!!$s for lines
T K
T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T RRRRRRRRRRRR