Result

AC

Duration

1261ms

Code [DL]

open String open List let rec r x=try r(read_line()::x)with _->x let _=r[]|>rev|>fold_left(fun l s->if l=0 then(print_endline s;index s 'T')else(print_endline(try(let i=index s 'K'in make i ' '^"K"^make(l-i)'*')with _->make l ' '^"*");l))0

stdin

                    T                             
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
       K                                          

stdout

                    T                             
                    *
                    *
                    *
                    *
                    *
                    *
                    *
       K*************

stderr

strace