by@coil_kpc
AC
750ms
program x character(len=50)::s read(*,'(a)')s print('(a)'),s j=index(s,'T') k=0 do while (k.eq.0) read(*, '(a)')s s(j:j)='R' k=index(s,'K') if(k.gt.0)then do i=k,j s(i:i)='R' end do end if print('(a)'),s end do end program x
T K
T R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R RRRRRRRRRR