Result

AC

Duration

1642ms

Code [DL]

import std.stdio;void main(){char c;for(int x;readf!"%s"(c);write(c|=x<1))x=c&4?0:-~x%51-c%2*51;}

stdin

                   T                              
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
                                                  
    K                                             

stdout

                   U                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
                   !                              
    K!!!!!!!!!!!!!!!                              

stderr

strace