Do you recognize the PPCG logo? it looks like this, when you do an ascii art of it.


Now, In this Code Golf, You will make a code, that makes logos for other sites, similar to the PPCG logo.

What You should do

The "Shortened" string will be the string, with all upper case letters and numbers in the input string.(Which would be PPCG when the input string is Programming Puzzles & Code Golf)

The "Box" (

|   |

) should fit the Shortened string perfectly.(No bigger or smaller)

Also the v part should be exactly 1 down and 1 left to the down right +.

Then output the box which has the shortened string in it.


Stack Overflow:


Area 51:



You may assume that the input contains at least one digit or upper case letter.

Standard rules apply.

  • \$\begingroup\$ Very closely related. Also related. \$\endgroup\$ – Martin Ender Jul 8 '16 at 7:02
  • \$\begingroup\$ @MartinEnder Yes, Very closely related, but not duplicate. \$\endgroup\$ – user54200 Jul 8 '16 at 7:03
  • 1
    \$\begingroup\$ @MatthewRoh The purpose of the links is so that the challenges show up in the sidebar, it's not a dupe vote. That said, I personally think removing the unwanted characters and also printing the ^ doesn't add much compared to the second challenge I linked, but I won't cast a dupe hammer on that but let the communitz decide whether they consider it a dupe or not. \$\endgroup\$ – Martin Ender Jul 8 '16 at 7:07
  • 4
    \$\begingroup\$ If it was 99 Bottles Of Beer, it would be 99BOB. \$\endgroup\$ – user54200 Jul 8 '16 at 7:27
  • 1
    \$\begingroup\$ @MatthewRoh its still buggy, let me see if i can get a bf answer after all \$\endgroup\$ – Rohan Jhunjhunwala Jul 29 '16 at 23:35

35 Answers 35


Vim, 42 strokes

YPVr-i+<DOWN><LEFT>|<ESC><C-V>ky$pYjppVr $xrv

Replace <DOWN> with , <LEFT> with , <ESC> with esc and <C-V> with CTRL+V.

Here's an animation of this script running (old version which uses a V instead of a v):


Explanation of the script:

:s/[^A-Z0-9]//g                               # Remove all the characters that are not uppercase or numbers using a Regex.
YPVr-                                         # Duplicate the current, and replace all the characters of the upper one with dashes.
     i+<DOWN><LEFT>|<ESC>                     # Insert a + on the upper line, and a | on the second line.
                         <C-V>ky$p            # Copy the + and | to the end of both lines.
                                  Yjpp        # Copy the upper line to the bottom two times.
                                      Vr $    # Replace the bottom most line with spaces and put the cursor on the last character.
                                          xrv # Remove the last character and replace the second last character with a v.
  • \$\begingroup\$ lowercase V, not uppercase V \$\endgroup\$ – user54200 Jul 8 '16 at 12:05
  • \$\begingroup\$ One character more, but avoids the special escaped characters: r|y uP$pYPVr-r+$.YjppVr $hrV \$\endgroup\$ – Bryce Wagner Jul 8 '16 at 12:06
  • \$\begingroup\$ You can replace i+↓←|␛␖ky$p with A+↓|␛␖ky0P to save a byte. \$\endgroup\$ – Lynn Jul 8 '16 at 23:32
  • \$\begingroup\$ Alternatively, replace the first eight strokes in Bryce’s approach with I|<END>|␛ \$\endgroup\$ – Lynn Jul 8 '16 at 23:41
  • \$\begingroup\$ I wonder if this has the most upvotes because of the cool picture. \$\endgroup\$ – Joe Jul 26 '16 at 18:59

V 34 bytes

ys$|ÄVr-r+$.YLppVr x$rv

Note that this worked in an older version, but doesn't work in the current version on try it online. I changed Ä to YP which is functionally equivalent.

Try it online!



Remove everything except for digits and uppercase characters.

ys$|              "Surround this line with '|' characters.
    Ä             "Duplicate this line
     Vr-          "Replace this whole duplicated line with '-' characters
        r+        "replace the first character with '+'
          $       "Move to the end of the line, and
           .      "Repeat our last command. This is the same as 'r+'
            Y     "Yank the current line
              pp  "and paste it twice
             L    "At the end of our text

Now, the buffer looks like this:


And our cursor is at the first column of the last line.

Vr                 "Change the whole last line to spaces
   x               "Delete a character
    $rv            "And change the last character to a 'v'

Non-competing version: (31 bytes)

  • \$\begingroup\$ I just noticed that the input Programming Puzzles & Code Golf produces the incorrect string PP&CG in the output. The & should be removed \$\endgroup\$ – Luis Mendo Jul 10 '16 at 13:02
  • \$\begingroup\$ @LuisMendo Aww, darn it! Thanks for pointing that out, I'll fix it sometime today. \$\endgroup\$ – James Jul 10 '16 at 14:43
  • \$\begingroup\$ @DrGreenEggsandIronMan So, you fixed it, right? [when? will? you? finally? fix? it?] \$\endgroup\$ – Erik the Outgolfer Jul 25 '16 at 10:31
  • \$\begingroup\$ I'm not getting any output on TIO? \$\endgroup\$ – Downgoat Jul 26 '16 at 18:02
  • \$\begingroup\$ @Downgoat V just recently had a huge update, and unfortunately it borked some things I'm looking into it, but I'm not sure how long it'll take to fix. \$\endgroup\$ – James Jul 26 '16 at 18:03

16-bit x86 machine code, 72 bytes

In hex:


Parameters: SI = input string, DI - output buffer.

Outputs a NULL-terminated string with lines delimited by newline. Uses input string as a temporary buffer.

56           push   si
57           push   di
89 f7        mov    di,si    ;Using source string as a buffer
31 c9        xor    cx,cx    ;Counter
fc           cld
ac           lodsb
84 c0        test   al,al    ;Test for NULL
74 14        jz     _draw    ;Break
3c 5a        cmp    al,'z'   ;\
77 f7        ja     _loop    ; |
3c 41        cmp    al,'a'    ; \
73 08        jae    _stor    ;  >[A-Z0-9]?
3c 39        cmp    al,'9'   ; /
77 ef        ja     _loop    ; |
3c 30        cmp    al,'0'   ;/
72 eb        jb     _loop
aa           stosb           ;Store char in the source buffer
41           inc    cx
eb e7        jmp    _loop
5f           pop    di
5e           pop    si
e8 15 00     call   _line    ;Output the first line
b0 7c        mov    al,'|'   ;This proc upon return leaves '\n' in AH
aa           stosb           ;First char of the second line
51           push   cx
f3 a4        rep    movsb    ;Copy CX logo characters from the source buffer
ab           stosw           ;Outputs "|\n", which is still in AX
59           pop    cx
e8 0a 00     call   _line    ;Output the third line
b0 20        mov    al,0x20  ;Space
f3 aa        rep    stosb    ;Output it CX times
b0 76        mov    al,'v'
aa           stosb           ;Output the final 'v'
91           xchg   cx,ax    ;CX == 0
aa           stosb           ;NULL-terminate the string
c3           retn            ;Return to caller
51           push   cx
b0 2b        mov    al,'+'
aa           stosb
b0 2d        mov    al,'-'
f3 aa        rep    stosb     ;'-'*CX
b8 2b 10     mov    ax,0x102b ;"+\n"
ab           stosw
59           pop    cx
c3           retn
  • \$\begingroup\$ Uhh.. I have not done assembly code for while. \$\endgroup\$ – user54200 Jul 9 '16 at 2:11
  • 3
    \$\begingroup\$ Me too. Started again about a week ago for golfing only \$\endgroup\$ – meden Jul 9 '16 at 2:21
  • \$\begingroup\$ 3c 41 cmp al,a' shouldn't it be 3c 41 cmp al,'a' ? \$\endgroup\$ – rav_kr Jul 9 '16 at 5:57
  • \$\begingroup\$ @rav_kr, sure, thanks fo noticing. Missed a quote while replacing hex codes with characters for readability. \$\endgroup\$ – meden Jul 12 '16 at 1:51

Retina, 43 bytes


+$.&$*-+¶|$&|¶+$.&$*-+¶$.&$* V

Try it online!

This is the perfect challenge to demonstrate Retina, Martin Ender's golfing language.

This solution is divided into two steps (what we call stages), both stages being a replacement stage.

The first stage:


This matches the substrings which match [^A-Z\d], which is the characters that are not uppercase and not digits, and then substitute them by nothing, meaning deleting them.

The second stage:

+$.&$*-+¶|$&|¶+$.&$*-+¶$.&$* V

The .+ matches the whole result, and then substitutes it with the second line.

In the second line:

  • $& refers to the whole match
  • $.& refers to the length of the whole match
  • $* means take the previous integer, repeat the next character that many times. Here $.&$*- means to repeat - however long the match is.
  • refers to a new-line.
  • \$\begingroup\$ Nice, I tried this earlier, but ended up with 54 bytes. An alternative for the first stage is T`dLp`dL_ but it's the same length, unfortunately. \$\endgroup\$ – Martin Ender Jul 8 '16 at 12:53
  • \$\begingroup\$ @MartinEnder What were your 54 bytes? \$\endgroup\$ – Leaky Nun Jul 8 '16 at 13:17
  • \$\begingroup\$ retina.tryitonline.net/… \$\endgroup\$ – Martin Ender Jul 8 '16 at 13:18

C#, 183 177 165 bytes

string h(string s){s=string.Concat(s.Where(n=>n>47&n<58|n>64 &n<91));int m=s.Length;var x=new string('-',m);return$"+{x}+\n|{s}|\n+{x}+\n{new string(' ', m + 1)}v";}

multiplying chars is terrible in C#. suggestions appreciated

thanks alot to aloisdg for -18 bytes


Excel VBA, 375 359 358 bytes:

It works, I give up on trying to make it shorter...

Edit: Switched to case statement from if statements, -16 bytes

Edit2: Got rid of u and replaced with Len(b), -1 byte

Function b(x)
For i = 1 To Len(x)
a = Mid(x, i, 1)
e = Asc(a)
If e > 64 And e < 91 Or e > 47 And e < 58 Then b = b & a
Next i
For Z = 1 To 4
y = ""
Select Case Z
Case 2
y = "|" & b & "|"
Case 4
For i = 1 To Len(b)
y = y & " "
Next i
y = y & "v"
Case Else
y = "+"
For i = 1 To Len(b)
y = y & "-"
Next i
y = y & "+"
End Select
Debug.Print y
Next Z
End Function
  • 3
    \$\begingroup\$ Its good though, considering that VBA is sometimes rubbish. \$\endgroup\$ – user54200 Jul 8 '16 at 13:21
  • \$\begingroup\$ I just do these for the challenge, I know I can't compete with VBA. Usually end up super confused at the end after changing all the variables from names to single letters. \$\endgroup\$ – tjb1 Jul 8 '16 at 13:57
  • \$\begingroup\$ Yeah ikr So true \$\endgroup\$ – user54200 Jul 8 '16 at 14:03
  • \$\begingroup\$ Can you remove the whitespace around operators? \$\endgroup\$ – Morgan Thrapp Jul 8 '16 at 18:37
  • 3
    \$\begingroup\$ Laughed at "Got rid of u" \$\endgroup\$ – CocoaBean Jul 9 '16 at 18:34

Lua, 145 99 Bytes

Not much to say, manipulating strings is always wordy in lua :). Takes a command-line argument and output via STDOUT

Thanks to @LeakyNun for saving me 45 Bytes !

n=(...):gsub("[^%u%d]","")s="+"..("-"):rep(#n).."+\n"return s.."|"..n.."|\n"..s..(" "):rep(#n).."V"

100 Bytes proposed by @LeakyNun

n=(...):gsub("[^A-Z%d]","")s="+"..("-"):rep(#n).."+\n"return s.."|"..n.."|\n"..s..(" "):rep(#n).."V"

OLD 145 Bytes

g="|"..(...):gsub("%a+",function(w)return w:sub(1,1)end):gsub("%s",'').."|"S="+"..g.rep("-",#g-2).."+"p=print
p(S)p(g)p(S)p(g.rep(" ",#g-2).."v")


g="|"                            -- g is the second, and starts with a |
  ..(...):gsub("%a+",            -- append the string resulting of the iteration on each word
    function(w)                  -- in the input, applying an anonymous function
      return w:sub(1,1)          -- that return the first character of the word
    end):gsub("%s",'')           -- then remove all spaces
  .."|"                          -- and append a |
S="+"..g.rep("-",#g-2).."+"      -- construct the top and bot of the box
p=print                          -- alias for print
p(S)p(g)p(S)                     -- output the box
p(g.rep(" ",#g-2).."v")          -- output #g-2 spaces (size of the shortened name), then v
  • 1
    \$\begingroup\$ Uhh, do you mean output via STDOUT? But I don't mind because ITS OPPOSITE DAY!!! \$\endgroup\$ – user54200 Jul 8 '16 at 7:35
  • 1
    \$\begingroup\$ @MatthewRoh I meant outputing to the STDIN of your terminal ! (fixed... shame....) \$\endgroup\$ – Katenkyo Jul 8 '16 at 7:37
  • \$\begingroup\$ n=(...):gsub("[^A-Z%d]","")s="+"..("-"):rep(#n).."+\n"return s.."|"..n.."|\n"..s..(" "):rep(#n).."V" is 100 bytes \$\endgroup\$ – Leaky Nun Jul 8 '16 at 11:43
  • \$\begingroup\$ @LeakyNun using the pattern %u we gain some more bytes. Anyway, thanks :) (will update the ungolfed later) \$\endgroup\$ – Katenkyo Jul 10 '16 at 14:22

2sable, 36 34 33 32 31 bytes

Presenting 2sable :). Although it has a lot in common with 05AB1E, this one actually auto joins the stack rather than outputting the top of the stack. Code:


Uses the CP-1252 encoding.

  • 2
    \$\begingroup\$ ಠ_ಠ No more golfing or language switches! Leave it where it is now! :P \$\endgroup\$ – James Jul 8 '16 at 8:12
  • \$\begingroup\$ @DrGreenEggsandIronMan Hahaha, it is still 3 painful bytes away from your answer :P. \$\endgroup\$ – Adnan Jul 8 '16 at 8:14
  • 1
    \$\begingroup\$ Haha, I was celebrating when I saw it 7 bytes longer, and then slowly watched the gap disappear, one by one... \$\endgroup\$ – James Jul 8 '16 at 8:15

JavaScript (ES6), 99 bytes

${s}${g(` `))v`

Haskell, 107 Bytes

This answer is heavily based on the answer by Zylviij and the comments by nimi. I would have added more comments to that answer, but alas, I don't have enough rep.

o n=t++'|':f++"|\n"++t++(f>>" ")++"v"where f=[c|c<-n,any(==c)$['0'..'9']++['A'..'Z']];t='+':(f>>"-")++"+\n"

Additional tricks used:

  • Replaced intersect by its implementation so the import can be dropped. (Side note: the implementation is nearly verbatim the library one, I couldn't find a shorter version.)
  • Moved the helper functions into the where clause so functions can use the n parameter internally.
  • After that, (#) was short enough to be inlined.
  • Put everything on one line to limit extra whitespace.

Python 3.5, 114 93 112 bytes:

import re;Y=re.findall('[A-Z0-9]',input());I='+'+'-'*len(Y)+'+\n|';print(I+''.join(Y)+I[::-1]+'\n'+' '*len(Y)+'v')

A full program. Basically uses a regular expression to match all occurrences of uppercase letters and numbers, then creates the box of the exact size based on the length of the list of matches, and finally puts the joined list of matches "inside" it.

Try It Online! (Ideone)

  • 5
    \$\begingroup\$ It's missing the bottom 'v'. \$\endgroup\$ – Carles Company Jul 8 '16 at 10:21
  • \$\begingroup\$ @CarlesCompany It's fixed, at the cost of 19 more bytes. \$\endgroup\$ – R. Kap Jul 8 '16 at 17:23

Python 3, 121 124 bytes

Fixed stupid mistake

for i in input():_=ord(i);s+=("",i)[91>_>64or 47<_<58]
print(c+"\n|"+s+"|\n"+c+"\n"+" "*x+"v")

does not import libraries like other python answer.


Java 8, 149 bytes

s->{s=s.replaceAll("[^A-Z0-9]","");String t="+",r;int l=s.length(),i=l;for(;i-->0;t+="-");for(r=(t+="+\n")+"|"+s+"|\n"+t;++i<l;r+=" ");return r+"v";}

Try it online.


s->{                     // Method with String as both parameter and return-type
                         //  Leave only the uppercase letters and digits
  String t="+",          //  Temp-String, starting at "+"
         r;              //  Result-String
  int l=s.length(),      //  Amount of uppercase letters and digits `l`
  i=l;for(;i-->0;t+="-");//  Loop and append `l` amount of "-" to the temp-String
  for(r=(t+="+\n")       //  Append "+" and a new-line to the temp-String
        +"|"+s+"|\n"+t;  //  Set the result to `t`, "|", modified input, "|", new-line, `t`
                         //  all appended to each other
      ++i<l;r+=" ");     //  Loop and append `l` amount of spaces to the result
  return r+"v";}         //  Return the result-String with appended "v"

Pyke, 39 bytes


Try it here!

12 bytes of mini-string creation, 20 bytes of formatting. Joy!


Pyth, 38 37 bytes

Jj*\-lK@jrG1UTz"++"jK"||"JtXJ"-+"" v

Try it online.

Note the newline in the start.


Python 2, 113 bytes

def f(n):c=filter(lambda x:x.isupper()^x.isdigit(),n);L=len(c);h='+'+L*'-'+'+\n';return h+'|'+c+'|\n'+h+' '*L+'v'
  • \$\begingroup\$ Can you use ascii in Python? If yes you can use 47<x<58|64<x<91 :) \$\endgroup\$ – aloisdg moving to codidact.com Jul 8 '16 at 14:48
  • \$\begingroup\$ @aloisdg Unlike C/C++, Python doesn't use an integral char type - all characters in Python strings are themselves strings, and cannot be directly compared with integers. It would need to be 47<ord(x)<58or 64<ord(x)<91. \$\endgroup\$ – Mego Jul 8 '16 at 15:15
  • \$\begingroup\$ [x for x in n if x.isupper()^x.isdigit()] is one byte shorter than filter(lambda x:x.isupper()^x.isdigit(),n) \$\endgroup\$ – Leaky Nun Jul 8 '16 at 17:10
  • \$\begingroup\$ @LeakyNun: filter will return a string, but the list comprehension will return a list, which won't be usable in the return value expression. \$\endgroup\$ – Nikita Borisov Jul 12 '16 at 2:36
  • \$\begingroup\$ Why XOR? Can't you use OR instead? XOR is more complex, and thus slower AFAIK. x.isupper()^x.isdigit() -> x.isupper()|x.isdigit() \$\endgroup\$ – Erik the Outgolfer Jul 25 '16 at 15:33

Jolf, 35 bytes

Ά+,Alγ/x"[^A-Z0-9]"1'+'-'|γS*lγ" 'v

I need a shorter way to remove all but caps & numbers...


C, 171 163

Function f() modifies its input and prints out the result.


Test Program

Requires one parameter, the string to use in the favicon:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

int main(int argc, const char **argv)
    char *input=malloc(strlen(argv[1])+1);
    return 0;
  • \$\begingroup\$ Why do you copy the argv element? \$\endgroup\$ – mame98 Jul 10 '16 at 13:19
  • \$\begingroup\$ Because the function modifies its input. I'm not sure modifying the parameters in place is defined behavior. \$\endgroup\$ – owacoder Jul 10 '16 at 20:08
  • \$\begingroup\$ never thought about this... according to this SO answer it should be fine: stackoverflow.com/a/963504/3700391 \$\endgroup\$ – mame98 Jul 10 '16 at 20:49

Haskell, 161

import Data.List
f n=intersect n$['0'..'9']++['A'..'Z']
t n='+':(r(l$f n)'-')++"+\n"
o n=(t n)++"|"++(f n)++"|\n"++(t n)++(r(l$f n)' ')++"V"


o"Stack Overflow"

o"Area 51"
  • 1
    \$\begingroup\$ You're using replicate, length and f exclusively in this combination, so you can merge them into one function: r=replicate.length.f and call it like r n '-'. You can save even more bytes by using an infix operator: (#)=replicate.length.f and n#'-' / n#' '. Additionally replicate.length is >> (with a singleton string instead of a char), so it's: (#)=(>>).f and n#"-" / n#" ", both without ( ) around it. \$\endgroup\$ – nimi Jul 11 '16 at 18:34
  • 1
    \$\begingroup\$ ... also: no need for the ( ) around t n and f n. "|"++ is '|':. All in all: o n=t n++'|':f n++"|\n"++t n++n#" "++"V". \$\endgroup\$ – nimi Jul 11 '16 at 18:40

Bash, 99 74 bytes

s=$(sed s/[^A-Z0-9]//g);a=${s//?/-};echo -e "+$a+\n|$s|\n+$a+\n${s//?/ }v"

Usage: Run the above command, type the site name, press enter and then Ctrl + D (send 'end of file').


CJam, 41


Try it online


R, 108 bytes

cat(x<-gsub("(.*)","+\\1+\n",gsub(".","-",y<-gsub("[^A-Z0-9]","",s))),"|",y,"|\n",x,gsub("."," ",y),"v",sep="")


Going from the inside out (because who doesn't love assigning global variables from inside a regex), assuming s is our input string:

y<-gsub("[^A-Z0-9]","",s) keeps capitals and numbers, assigns the resulting value to y.

gsub(".","-",y<-...) replaces all characters with hyphens in the above.

x<-gsub("(.*)","+\\1+\n",gsub(...)) chucks a + on either end of the row of hyphens, and a newline, and we store that as x.

The rest is pretty straightforward, output in the appropriate order, and use the fact that the number of spaces before the v will be the same as the length of y.


Brachylog, 61 bytes

Linked to the repository at Jul 7 to ensure backward compatibility.

lybL:{,."-"}ac:"+"c:"+"rcAw@NNw"|"Bw?wBwNwAwNwL:{," "w}a,"v"w

Non-competing, 53 bytes

lL:"-"rjb:"+"c:"+"rcAw@NNw"|"Bw?wBwNwAwNw" ":Ljbw"v"w

Try it online!


APL, 52 49 bytes


(down to 49 thanks to the comment).

  • \$\begingroup\$ {x⍪2⌽'v'↑⍨≢⍉x←⍉z⍪⍨(z←'+|+')⍪'-','-',⍨⍪⍵/⍨⍵∊⎕D,⎕A} (You never parenthesize one of the arguents in a reversed argument function when golfing. It always can be in normal order to save a byte.) \$\endgroup\$ – Zacharý Jul 31 '17 at 21:52

Perl, 57 bytes

56 bytes code + 1 for -p.

y/a-z //d;$d="-"x y///c;$_="+$d+
".$"x y///c.v

I originally tried to make this only using regexes, but it was much larger than I'd hoped, so I've used some string repetition instead.

Try it online!


MATL, 34 bytes


Try it online!

t        % Implicit input. Duplicate
1Y2      % Uppercase letters
4Y2      % Digit characters
h        % Concatenate horizontally: string with uppercase letters and digits
m        % True for input chars that are uppercase letters or digits
)        % Keep only those
T45&Ya   % Pad up and down with character 45, which is '-'. Gives three-row char array
'+|+'!   % Push this string and transpose into a column vector
wy       % Swap, duplicate the second array from the top. This places one copy of the
         % column vector below and one above the three-row char array
&h       % Contatenate all stack arrays horizontally. This gives the box with the text
10M      % Retrieve the string with selected letters
~        % Logical negate. Gives zeros, which will be displayes as spaces
'v'      % Push this character
h        % Concatenate horizontally with the zeros.
         % Implicitly display the box with the text followed by the string containing
         % the zero character repeated and the 'v'

JavaScript (ES6), 119 bytes

h=a=>"+"+"-".repeat(a.length)+"+\n";j=a=>(a=a.replace(/[^A-Z0-9]/g,""),h(a)+"|"+a+"|\n"+h(a)+" ".repeat(a.length)+"v");

J, 52 bytes

'v'(<3 _2)}4{.1":]<@#~2|'/9@Z'&I.[9!:7@'+++++++++|-'

Try it online!

   [9!:7@'+++++++++|-'            Set the box drawing characters.
        '/9@Z'&I.                 Interval index, 1 for numbers, 3 for 
                                  uppercase letters.
          ]  #~2|                 Mod 2, and filter
                                  the characters that correspond to 1s.
           <@                     Put them in a box.
           1":                    Convert to a character matrix, so we can do stuff to it.
           4{.                    Add a 4th line filled with spaces   
       'v'(<3 _2)}                Insert a “v” at 3,−2

Ruby, 81 bytes (78 + -p flag)

#{' '*s}v"}

Common Lisp (Lispworks), 159 bytes bytes

(defun f(s)(labels((p(c l)(dotimes(i l)(format t"~A"c))))(let((l(length s)))#1=(p"+"1)#2=(p"-"l)#3=(format t"+~%")(format t"|~A|~%"s)#1##2##3#(p" "l)(p"v"1))))


(defun f (s)
  (labels ((p (c l)
             (dotimes (i l)
               (format t "~A" c))))
    (let ((l (length s)))
      #1=(p "+" 1)
      #2=(p "-" l)
      #3=(format t "+~%")
      (format t "|~A|~%" s)
      (p " " l)
      (p "v" 1))))


CL-USER 2 > (f "so")

CL-USER 3 > (f "pcg")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy