Result

AC

Duration

967ms

Code [DL]

{sub(/ +$/,z);if($0){for(;t&&length($0)-length(t);)$0=$0"K";t=$0}}$0=t

stdin

                 T                                
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
            K                                     

stdout

                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
                 T
            KKKKKK

stderr

strace