Result

AC

Duration

735ms

Code [DL]

R=io.read"*a"
print((R:gsub((" "):rep(50),R:sub(1,50)):gsub("K",("*"):rep(1+R:find("T")-R:find("K")%51))))

stdin

                                             T    
                                                  
                                                  
                                                  
                                                  
                                                  
             K                                    

stdout

                                             T    
                                             T    
                                             T    
                                             T    
                                             T    
                                             T    
             *********************************                                    

stderr

strace