by@shotcf12
AC
715ms
program x character(len=50)::s read(*,'(a)')s print('(a)'),s j=index(s,'T') do read(*, '(a)')s s(j:j)='R' k=index(s,'K') if(k>0)then do i=1,k-1 write(*,'(a)',advance='no')' ' end do do i=k,j write(*,'(a)',advance='no')'R' end do do i=1,50 write(*,'(a)',advance='no')' ' end do exit else print('(a)'),s end if 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 RRRRRRRRRRRRRRRR