box paint by croyal

main(){
 int c,l,b,f;
 b=f=0;
 l=-1;
 c=getchar();
 while(c!=-1){
    if(c=='\n'){
       b=f=0;
    } else if(c=='#' && l=='#'){
       f=1;
    } else if(b==0 && f==0 && l=='#' && c==' '){
       b=1;
    } else if((b==1 || f==1) && l=='#' && c==' '){
       f=0;b=0;
    }
    if(c=='#'){
       putchar(c);
    } else if(b==1){
       putchar('.');
    } else{
       putchar(c);
    }
    l=c;
    c=getchar();
 }
}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page