Result

AC

Duration

2334ms

Code [DL]

main=interact$unlines.s(((f.span(<'J')).).zipWith max).lines
f(x,y)=x++s max y
s=scanr1

stdin

            T                                     
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
    K                                             

stdout

    TTTTTTTTT                                     
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             
    K                                             

stderr

strace