Result

AC

Duration

803ms

Code [DL]

a,*b,c=*$<;puts a,b.map{a},' '*(g=c=~/K/)+?a*(1-g-=a=~/T/)

stdin

                                            T     
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
       K                                          

stdout

                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
                                            T     
       aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

stderr

strace