Result

AC

Duration

666ms

Code [DL]

NR==1{gsub("T(.+)","T");t=$0}NR>1{print t}END{gsub("K(.+)","K");while(length($0)<length(t)){sub("K","KK")}print $0}

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
 KKKKKKKKKKKKKKKKKKK

stderr

strace