Result

AC

Duration

675ms

Code [DL]

read "s" =
s p
s "T" find "t" =
1 while
read "K" find "k" =
k if
" " k 1 - rep w
"K" t k - 1 + rep p
exit
end
s p
1
end

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           
                                      T           
                                      T           
                                      T           
                                      T           
                                      T           
                                      T           
                                      T           
                   KKKKKKKKKKKKKKKKKKKK

stderr

strace