Result

AC

Duration

750ms

Code [DL]

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

stdin

             T                                    
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
    K                                             

stdout

             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                                    

stderr

strace