Result

AC

Duration

739ms

Code [DL]

$_,*b,c=*$<;c[?K]=?a*99;puts$_*-~b.size,c[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            
                                     T            
                                     T            
                                     T            
                                     T            
                                     T            
                                     T            
                                     T            
                                     T            
                                     T            
                                     T            
                                     T            
                             aaaaaaaaa

stderr

strace