Result

AC

Duration

723ms

Code [DL]

f={case[p,q]->p}
g={case[i,s]->if(i==0)""else g([i-1,s])+s}
stdin|reduce(["",""],{case[c,d],s->if(c.length>0){v=s.split("K");if(v.length>=2)d+"\n"+f(v)+g([f(c.split("T")).length-f(v).length+1,"A"])else[c,d+"\n"+c]}else[s,s]})|stdout

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                                 
   AAAAAAAAAAAAAA

stderr

strace

10    execve("/bin/sh", ["/bin/sh", "/root/script", "/volume/CODE"], 0x7ffd340d19e0 /* 7 vars */) = 0
11    execve("/bin/cat", ["cat", "-"], 0x564cc90bdd30 /* 7 vars */) = 0
11    +++ exited with 0 +++
10    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=11, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
12    execve("/usr/bin/streem", ["/usr/bin/streem", "/volume/CODE"], 0x564cc90bdd40 /* 7 vars */) = 0
13    +++ exited with 0 +++
15    +++ exited with 0 +++
14    +++ exited with 0 +++
12    +++ exited with 0 +++
10    --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=12, si_uid=0, si_status=0, si_utime=0, si_stime=0} ---
10    +++ exited with 0 +++