Result

AC

Duration

810ms

Code [DL]

a,*b,c=open(0)
i=a.find("T")
x=a
for l in b:x+=a
j=c.find("K")
print(x+" "*j+"*"*(1+i-j))

stdin

                  T                               
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
         K                                        

stdout

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

stderr

strace