Result

AC

Duration

858ms

Code [DL]

l=(""+require('fs').readFileSync(0))
console.log(l.replace(/((K|\s){50})./g,"$1T").replace(/(?<=K.*) (?=.*T)/g,"*"))

stdin

                    T                             
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
K                                                 

stdout

                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
                    T                             
K*******************T                             

stderr

strace