Result

AC

Duration

889ms

Code [DL]

say $!=get;say m|K|??S[K]='K'x$!.index('T')-$/.from+1!!$! for lines

stdin

                       T                          
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
          K                                       

stdout

                       T                          
                       T                          
                       T                          
                       T                          
                       T                          
                       T                          
                       T                          
                       T                          
          KKKKKKKKKKKKKK                                       

stderr

strace