Result

AC

Duration

1159ms

Code [DL]

s=""+require("fs").readFileSync(0);console.log(s.replace(eval(`/(\\n.{${s.search(/T/)}})./g`),"$1T").replace(/K */,m=>"K".repeat(m.length)))

stdin

                                T                 
                                                  
                                                  
                                                  
                      K                           

stdout

                                T                 
                                T                 
                                T                 
                                T                 
                      KKKKKKKKKKT                 

stderr

strace