Result

AC

Duration

640ms

Code [DL]

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

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
            KKKKK

stderr

strace