Oreoorererereoo












56















Oreoorererereoo



Given an input string that is similar to the word "oreo", give an ASCII representation of the cookie that is as wide as the input string (to ensure cookie stability).



Rules




  • The input is lowercase, a non-empty string with no whitespace containing any combination of the strings "o" and "re", and containing only those strings.

  • The string "o" represents the solid cookie, while the string "re" represents the filling.

  • The output must be a stacked cookie that is as wide as the input string.

  • The output may not be an array of strings

  • The cookie must overlap the filling by one character on each side

  • The characters used for the output don't have to match the output below (█ and ░), they just have to be different non-whitespace characters for the two parts of the cookie

  • The whitespace padding on the left side of the filling is required, and any trailing whitespace is optional


Examples



Input: oreo
Output:
████
░░
████

Input: o
Output:


Input: re
Output: (two spaces)


Input: rere
Output:
░░
░░

Input: oreoorererereoo
Output:
███████████████
░░░░░░░░░░░░░
███████████████
███████████████
░░░░░░░░░░░░░
░░░░░░░░░░░░░
░░░░░░░░░░░░░
░░░░░░░░░░░░░
███████████████
███████████████


Since this is code golf the shortest answer wins, good luck :)










share|improve this question




















  • 3





    "The whitespace padding on each side of the filling is required". Does this actually mean that there must be a space character at the end of each line of filling? If so why? As long as it works visually then what does this requirement add to the challenge?

    – ElPedro
    Jan 6 at 0:23











  • @ ElPedro Good point, I modified the rules and @Dennis I edited the rules so the comments should be okay to clean up

    – GammaGames
    Jan 7 at 3:22













  • @JonathanAllan Since it's printing "ascii-art" I removed that rule, it looks like I forgot to update the question. Should be updated now.

    – GammaGames
    Jan 7 at 16:05













  • Awesome, thanks!

    – Jonathan Allan
    Jan 7 at 16:18











  • @GammaGames, if whitespace on the right is not required anymore, I assume the output for test case re should be now acceptable as 1 or 2 spaces, not necessarily 2?

    – Kirill L.
    yesterday
















56















Oreoorererereoo



Given an input string that is similar to the word "oreo", give an ASCII representation of the cookie that is as wide as the input string (to ensure cookie stability).



Rules




  • The input is lowercase, a non-empty string with no whitespace containing any combination of the strings "o" and "re", and containing only those strings.

  • The string "o" represents the solid cookie, while the string "re" represents the filling.

  • The output must be a stacked cookie that is as wide as the input string.

  • The output may not be an array of strings

  • The cookie must overlap the filling by one character on each side

  • The characters used for the output don't have to match the output below (█ and ░), they just have to be different non-whitespace characters for the two parts of the cookie

  • The whitespace padding on the left side of the filling is required, and any trailing whitespace is optional


Examples



Input: oreo
Output:
████
░░
████

Input: o
Output:


Input: re
Output: (two spaces)


Input: rere
Output:
░░
░░

Input: oreoorererereoo
Output:
███████████████
░░░░░░░░░░░░░
███████████████
███████████████
░░░░░░░░░░░░░
░░░░░░░░░░░░░
░░░░░░░░░░░░░
░░░░░░░░░░░░░
███████████████
███████████████


Since this is code golf the shortest answer wins, good luck :)










share|improve this question




















  • 3





    "The whitespace padding on each side of the filling is required". Does this actually mean that there must be a space character at the end of each line of filling? If so why? As long as it works visually then what does this requirement add to the challenge?

    – ElPedro
    Jan 6 at 0:23











  • @ ElPedro Good point, I modified the rules and @Dennis I edited the rules so the comments should be okay to clean up

    – GammaGames
    Jan 7 at 3:22













  • @JonathanAllan Since it's printing "ascii-art" I removed that rule, it looks like I forgot to update the question. Should be updated now.

    – GammaGames
    Jan 7 at 16:05













  • Awesome, thanks!

    – Jonathan Allan
    Jan 7 at 16:18











  • @GammaGames, if whitespace on the right is not required anymore, I assume the output for test case re should be now acceptable as 1 or 2 spaces, not necessarily 2?

    – Kirill L.
    yesterday














56












56








56


11






Oreoorererereoo



Given an input string that is similar to the word "oreo", give an ASCII representation of the cookie that is as wide as the input string (to ensure cookie stability).



Rules




  • The input is lowercase, a non-empty string with no whitespace containing any combination of the strings "o" and "re", and containing only those strings.

  • The string "o" represents the solid cookie, while the string "re" represents the filling.

  • The output must be a stacked cookie that is as wide as the input string.

  • The output may not be an array of strings

  • The cookie must overlap the filling by one character on each side

  • The characters used for the output don't have to match the output below (█ and ░), they just have to be different non-whitespace characters for the two parts of the cookie

  • The whitespace padding on the left side of the filling is required, and any trailing whitespace is optional


Examples



Input: oreo
Output:
████
░░
████

Input: o
Output:


Input: re
Output: (two spaces)


Input: rere
Output:
░░
░░

Input: oreoorererereoo
Output:
███████████████
░░░░░░░░░░░░░
███████████████
███████████████
░░░░░░░░░░░░░
░░░░░░░░░░░░░
░░░░░░░░░░░░░
░░░░░░░░░░░░░
███████████████
███████████████


Since this is code golf the shortest answer wins, good luck :)










share|improve this question
















Oreoorererereoo



Given an input string that is similar to the word "oreo", give an ASCII representation of the cookie that is as wide as the input string (to ensure cookie stability).



Rules




  • The input is lowercase, a non-empty string with no whitespace containing any combination of the strings "o" and "re", and containing only those strings.

  • The string "o" represents the solid cookie, while the string "re" represents the filling.

  • The output must be a stacked cookie that is as wide as the input string.

  • The output may not be an array of strings

  • The cookie must overlap the filling by one character on each side

  • The characters used for the output don't have to match the output below (█ and ░), they just have to be different non-whitespace characters for the two parts of the cookie

  • The whitespace padding on the left side of the filling is required, and any trailing whitespace is optional


Examples



Input: oreo
Output:
████
░░
████

Input: o
Output:


Input: re
Output: (two spaces)


Input: rere
Output:
░░
░░

Input: oreoorererereoo
Output:
███████████████
░░░░░░░░░░░░░
███████████████
███████████████
░░░░░░░░░░░░░
░░░░░░░░░░░░░
░░░░░░░░░░░░░
░░░░░░░░░░░░░
███████████████
███████████████


Since this is code golf the shortest answer wins, good luck :)







code-golf string ascii-art






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 7 at 16:03







GammaGames

















asked Jan 4 at 1:09









GammaGamesGammaGames

592211




592211








  • 3





    "The whitespace padding on each side of the filling is required". Does this actually mean that there must be a space character at the end of each line of filling? If so why? As long as it works visually then what does this requirement add to the challenge?

    – ElPedro
    Jan 6 at 0:23











  • @ ElPedro Good point, I modified the rules and @Dennis I edited the rules so the comments should be okay to clean up

    – GammaGames
    Jan 7 at 3:22













  • @JonathanAllan Since it's printing "ascii-art" I removed that rule, it looks like I forgot to update the question. Should be updated now.

    – GammaGames
    Jan 7 at 16:05













  • Awesome, thanks!

    – Jonathan Allan
    Jan 7 at 16:18











  • @GammaGames, if whitespace on the right is not required anymore, I assume the output for test case re should be now acceptable as 1 or 2 spaces, not necessarily 2?

    – Kirill L.
    yesterday














  • 3





    "The whitespace padding on each side of the filling is required". Does this actually mean that there must be a space character at the end of each line of filling? If so why? As long as it works visually then what does this requirement add to the challenge?

    – ElPedro
    Jan 6 at 0:23











  • @ ElPedro Good point, I modified the rules and @Dennis I edited the rules so the comments should be okay to clean up

    – GammaGames
    Jan 7 at 3:22













  • @JonathanAllan Since it's printing "ascii-art" I removed that rule, it looks like I forgot to update the question. Should be updated now.

    – GammaGames
    Jan 7 at 16:05













  • Awesome, thanks!

    – Jonathan Allan
    Jan 7 at 16:18











  • @GammaGames, if whitespace on the right is not required anymore, I assume the output for test case re should be now acceptable as 1 or 2 spaces, not necessarily 2?

    – Kirill L.
    yesterday








3




3





"The whitespace padding on each side of the filling is required". Does this actually mean that there must be a space character at the end of each line of filling? If so why? As long as it works visually then what does this requirement add to the challenge?

– ElPedro
Jan 6 at 0:23





"The whitespace padding on each side of the filling is required". Does this actually mean that there must be a space character at the end of each line of filling? If so why? As long as it works visually then what does this requirement add to the challenge?

– ElPedro
Jan 6 at 0:23













@ ElPedro Good point, I modified the rules and @Dennis I edited the rules so the comments should be okay to clean up

– GammaGames
Jan 7 at 3:22







@ ElPedro Good point, I modified the rules and @Dennis I edited the rules so the comments should be okay to clean up

– GammaGames
Jan 7 at 3:22















@JonathanAllan Since it's printing "ascii-art" I removed that rule, it looks like I forgot to update the question. Should be updated now.

– GammaGames
Jan 7 at 16:05







@JonathanAllan Since it's printing "ascii-art" I removed that rule, it looks like I forgot to update the question. Should be updated now.

– GammaGames
Jan 7 at 16:05















Awesome, thanks!

– Jonathan Allan
Jan 7 at 16:18





Awesome, thanks!

– Jonathan Allan
Jan 7 at 16:18













@GammaGames, if whitespace on the right is not required anymore, I assume the output for test case re should be now acceptable as 1 or 2 spaces, not necessarily 2?

– Kirill L.
yesterday





@GammaGames, if whitespace on the right is not required anymore, I assume the output for test case re should be now acceptable as 1 or 2 spaces, not necessarily 2?

– Kirill L.
yesterday










41 Answers
41






active

oldest

votes













1 2
next












13















Jelly,  16 14  13 bytes



-1 Thanks to Erik the Outgolfer



OḂƇẒṁ€aØ.¦€⁶Y


Uses 1 for the cream and 0 for the cookie.



Try it online!



How?



OḂƇẒṁ€aØ.¦€⁶Y - Main Link: list of characters, V    e.g. 'orereo'
O - ordinal (vectorises) [111,114,101,114,101,111]
Ƈ - filter keep those for which:
Ḃ - modulo 2 [111, 101, 101,111]
Ẓ - is prime? (vectorises) [ 0, 1, 1, 0]
ṁ€ - mould each like V [[0,0,0,0,0,0],[1,1,1,1,1,1],[1,1,1,1,1,1],[0,0,0,0,0,0]]
€ - for each:
¦ - sparse application...
Ø. - ...to indices: literal [0,1] (0 is the rightmost index, 1 is the leftmost)
a - ...apply: logical AND with:
⁶ - space character [[0,0,0,0,0,0],[' ',1,1,1,1,' '],[' ',1,1,1,1,' '],[0,0,0,0,0,0]]
Y - join with newline characters [0,0,0,0,0,0,'n',' ',1,1,1,1,' ','n',' ',1,1,1,1,' ','n',0,0,0,0,0,0]
- implicit print ...smashes everything together:
- 000000
- 1111
- 1111
- 000000




Previous 16 byter:



ḟ”eẋ€Ly@Ø.¦€⁾r Y


Uses r for the cream and o for the cookie.



Try it online!






share|improve this answer


























  • I was hoping for a Jelly entry, such an interesting language!

    – GammaGames
    Jan 4 at 17:39



















17





+50










Pepe, 364 bytes



Unfortunately the online interpreter does not take care of compressing comments, hence all o characters will be replaced by a space.. Neither the spaces nor the o are necessary, so this could be 295 bytes, but I like it more this way:





rEeEEeeEeEororEEoreoreeeEeeeeeorEEEEeoREeoreorEeEEeEEEEororEEoreorEEEEEoREeoreorEeEEEeeEeororEEoreoReoREoREEEeoREEEEEoreorEorEEEeorEEEEEoreEoREeoreoREEeoREEEEeEeeoREEEeoREeeEoREEEeoREEEEEEEorEEEeEorEEEeoREoREEEeoREEEEEoREEoReoreorEEEeEoREEEEEEeorEEEeoReEoREoREEEeoREEoReoroReEeoREoREEEeorEEEEeoReeoREEEeoREeeEoREEEeoREEEEEEEoreoReoReoREoREEEeoREEEEEoreeeeeEeEeoRee


Try it online!



Ungolfed



There might be some golfing oppurtunities with flags which I missed, but I'm done for now:



# "function" for 'e'
rEeEEeeEeE rrEE
re # remove duplicated argument
reeeEeeeee # print space
rEEEEe # decrement counter twice
REe re

# "function" for 'o'
rEeEEeEEEE rrEE
re # remove duplicated argument
rEEEEE # increment counter
REe re

# "function for 'r'
rEeEEEeeEe rrEE
re Re # remove duplicated argument & char
RE REEEe REEEEE # push 1
re rE rEEEe rEEEEE # replace 1
reE # goto 1
REe re

# Main

REEe REEEEeEee # read input & reverse
REEEe REeeE REEEe REEEEEEE # push length-1 & move to r

rEEEeE rEEEe # dummy loop-var (fucking do-whiles...)
RE REEEe REEEEE REE # while [label-1]

# Call the right procedure depending on current character,
# sets stacks up as follows:
# R [ .... *currentChar ]
# r [ (N-1) *count ]
Re re # pop 1 & loop-counter
rEEEeE # duplicate counter
REEEEEEe rEEEe # copy current char to other stack
ReE # jeq to 'o'-label or 'e'-label

# Output currentChar count times:
RE REEEe REE # while [label-0]:
Re # pop 0
rReEe # print character
RE REEEe # push 0
rEEEEe # decrement counter
Ree

REEEe REeeE REEEe REEEEEEE # push length-1 & move to r
re Re Re # pop 0, counter and 9((((currentChar
RE REEEe REEEEE # push 1
reeeeeEeEe # print new-line

Ree





share|improve this answer





















  • 1





    I moved this conversation to chat for you.

    – DJMcMayhem
    2 days ago





















9















Canvas, 19 18 17 bytes



e ∙╋
:r≠*┤];L×⁸↔⁸


Try it here!



Uses the annoyingly long code of :r≠*┤] to remove rs from the input..






share|improve this answer


























  • That's a handy feature, and cool language!

    – GammaGames
    Jan 4 at 1:48



















7















Japt -R, 16 15 bytes



re ¬£çX sX²èrÃû


Try it



                    :Implicit input of string U
re :Remove all "e"s
¬ :Split to array of characters
£ :Map each X
çX : Repeat X to the length of U
s : Slice from index
X² : Duplicate X
èr : Count the occurrences of "r"
à :End map
û :Centre pad each element with spaces to the length of the longest
:Implicitly join with newlines and output




Alternatives



re ¬ËpUÊaD²èrÃû
re ¬£îX rr²i^Ãû





share|improve this answer

































    6















    C# (Visual C# Interactive Compiler), 95 bytes





    n=>n.Replace("o",new String('-',n.Length)+"n").Replace("re"," ".PadRight(n.Length-1,'|')+"n")


    Try it online!



    Alternative using Aggregate, 108 bytes





    n=>n.Aggregate("",(d,c)=>d+(c<102?"":c<112?new String('-',n.Length)+"n":" ".PadRight(n.Length-1,'|')+"n"))


    Try it online!






    share|improve this answer





















    • 1





      now it trims trailing spaces..

      – dzaima
      Jan 4 at 1:50











    • There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

      – GammaGames
      Jan 4 at 4:40











    • Your replace doesn't work when the input is o, since the n.Length-2 will result in -1.

      – Kevin Cruijssen
      Jan 4 at 10:18











    • The n.Length-2 is is for when the input has re.

      – Embodiment of Ignorance
      Jan 4 at 16:27



















    6















    R, 106 bytes





    function(s,N=nchar(s)){m=rep(el(strsplit(gsub('re',0,s),'')),e=N)
    m[m<1&seq(m)%%N<2]=' '
    write(m,1,N,,"")}


    Try it online!




    • -12 bytes thanks to @Giuseppe




    Previous version with explanation :




    R, 118 bytes





    function(s,N=nchar(s)){m=t(replicate(N,el(strsplit(gsub('re',0,s),''))))
    m[m<1&row(m)%in%c(1,N)]=' '
    write(m,1,N,,'')}


    Try it online!




    • -1 byte thanks to @Giuseppe


    Unrolled code and explanation :



    function(s){                       # s is the input string, e.g. 'oreo'

    N = nchar(s) # store the length of s into N, e.g. 4

    s1 = gsub('re',0,s) # replace 're' with '0' and store in s1, e.g. 'o0o'

    v = el(strsplit(s1,'')) # split s1 into a vector v of single characters
    # e.g. 'o','0','o'

    m = replicate(N,v) # evaluate N times the vector v and arrange
    # the result into a matrix m (nchar(s1) x N)
    # e.g.
    # 'o' 'o' 'o' 'o'
    # '0' '0' '0' '0'
    # 'o' 'o' 'o' 'o'


    m = t(m) # transpose the matrix

    m[m<1 & row(m)%in%c(1,N)] = ' ' # substitute the zeros (i.e. where < 1)
    # on the 1st and last row of the matrix with ' ' (space)
    # e.g.
    # 'o' ' ' 'o'
    # 'o' '0' 'o'
    # 'o' '0' 'o'
    # 'o' ' ' 'o'

    write(m,1,N,,'') # write the matrix to stdout (write function transposes it)
    # e.g.
    # oooo
    # 00
    # oooo
    }





    share|improve this answer


























    • 106 bytes

      – Giuseppe
      Jan 4 at 22:40











    • aaand 104 bytes returning a list of lines, which isn't acceptable here, but it's an interesting idea (essentially my SNOBOL submission translated to R)

      – Giuseppe
      Jan 4 at 23:11



















    6















    05AB1E, 18 17 16 bytes



    'eKεD'rQ2*Igα×}.c


    -1 byte thanks to @Emigna



    Uses o for the cookie and r for the filling.



    Try it online or verify all test cases.



    Explanation:





    'eK                 '# Remove all "e" from the (implicit) input
    # i.e. "orereo" → "orro"
    ε } # Map all characters to:
    D # Duplicate the current character
    'rQ '# Check if it's an "r" (1 if truthy; 0 if falsey)
    # i.e. "r" → 1
    # i.e. "o" → 0
    · # Double that
    # i.e. 1 → 2
    # i.e. 0 → 0
    Ig # Take the length of the input
    # i.e. "orereo" → 6
    α # Take the absolute difference between the two
    # i.e. 2 and 6 → 4
    # i.e. 0 and 6 → 6
    × # Repeat the duplicated character that many times
    # i.e. "r" and 4 → "rrrr"
    # i.e. "o" and 6 → "oooooo"
    .c # Then centralize it, which also imlicitly joins by newlines
    # (and the result is output implicitly)
    # i.e. ["oooooo","rrrr","rrrr","oooooo"]
    # → "oooooon rrrrn rrrrnoooooo"





    share|improve this answer


























    • Creative solution, But it does not solve the problem entirely: oro would give a wrong answer

      – Mark Smit
      Jan 6 at 9:15











    • @MarkSmit oro isn't a possible input, since the input will only contain os and res. Regardless, oro still seems to output correctly following the spec, since it outputs ooon rnooo. What is wrong about it?

      – Kevin Cruijssen
      Jan 6 at 10:44













    • This is invalid: "The whitespace padding on each side of the filling is required"

      – NieDzejkob
      Jan 6 at 15:14











    • 2* can be · and the missing whitespace can be fixed by changing ».c to .c.B»

      – Emigna
      Jan 7 at 9:29











    • @Emigna Ah, can't believe I haven't thought about ·, thanks! :) And always nice to have changing specs during the challenge, sigh..

      – Kevin Cruijssen
      Jan 7 at 9:40





















    5















    Retina, 74 73 bytes



    I feel like I haven't posted an answer in a very long time. Well, here I am. Also, Retina has changed a lot, and I feel like I suck at it now.



    .+
    $0$.0
    (d+)
    *
    e

    o|r
    $&¶
    _$

    +(/_/&`o¶
    oo¶
    _$

    )/_/&`r¶
    rr¶
    ¶$

    m`^r



    Try it online!






    share|improve this answer





















    • 1





      Whoa, what a crazy looking language. I like it!

      – GammaGames
      Jan 4 at 1:58











    • doesn't include trailing whitespaces..

      – dzaima
      Jan 4 at 2:00






    • 2





      I like how [or] means o or r instead of [ or ]. Makes my head hurt.

      – nedla2004
      Jan 4 at 2:43











    • @dzaima The question does not specify that trailing whitespaces are required. A comment asked, but no reply was given.

      – mbomb007
      Jan 4 at 19:44











    • @nedla2004 That actually helped me notice a way to save a byte. Thanks.

      – mbomb007
      Jan 4 at 19:44



















    5















    Retina, 21 bytes



    r

    L$`.
    $.+*$&
    bee



    Try it online! Explanation:



    r



    Delete the rs.



    L$`.
    $.+*$&


    List each letter on its own line repeated to the length of the original input.



    bee



    Replace the first two ees on each line with a space.






    share|improve this answer


























    • This breaks the rules: "The whitespace padding on each side of the filling is required"

      – NieDzejkob
      Jan 6 at 15:16











    • @NieDzejkob Sorry for overlooking that, should be fixed now.

      – Neil
      Jan 6 at 16:14











    • FYI trailing whitespace requirement lifted.

      – P1h3r1e3d13
      Jan 8 at 0:26











    • @Neil You should fix that &amp; :P

      – ASCII-only
      Jan 8 at 0:35



















    4














    JavaScript ES6, 103 bytes



    Using replace 103 bytes:





    x=>x.replace(/o/g,"-".repeat(s=x.length)+`
    `).replace(/re/g," "+"|".repeat(s>1?s-2:0)+`
    `).slice(0,-1)


    Try it online!



    Using split and map 116 bytes:





    x=>x.split("re").map(y=>("-"[h='repeat'](r=x.length)+`
    `)[h](y.length)).join(" "+"|"[h](r>1?r-2:0)+`
    `).slice(0,-1)


    Try it online!






    share|improve this answer





















    • 1





      JS, nice! You reminded me that I was going to add a rule about not having line returns at the end of the output, I've added it. Sorry about that!

      – GammaGames
      Jan 4 at 1:45






    • 3





      just removing the final newline is 12 bytes

      – fəˈnɛtɪk
      Jan 4 at 1:51











    • There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

      – GammaGames
      Jan 4 at 4:44






    • 3





      You can save a byte by using a template string with ${"|".repeat(s>1?s-2:0)} and its whitespaces, instead of using " "+"|".repeat(s>1?s-2:0).

      – Ismael Miguel
      Jan 4 at 10:26













    • If you use backticks for the string in the first split, you can remove the parentheses around it.

      – skiilaa
      9 hours ago



















    4















    Python 3, 77 bytes





    lambda x:x.replace("o","-"*len(x)+"n").replace("re"," "+'.'*(len(x)-2)+"n")


    Try it online!






    share|improve this answer


























    • Clever! I did intend the output to not be printing whitespace for the filling (it's pretty much oreo ascii), so I have edited the rules accordingly. Sorry about that! And I always love a python answer :)

      – GammaGames
      Jan 4 at 4:50













    • @JonathanFrech migth as well delete the comments, that approach was invalidated. I'll work on golfing more tomorrow.

      – Riker
      Jan 4 at 4:55











    • You can remove the space at +" n" to save a byte.

      – Kevin Cruijssen
      Jan 4 at 10:37











    • @KevinCruijssen can I? The input program says the whole cookie must be as wide as the input.

      – Riker
      Jan 4 at 16:18






    • 2





      I interpreted that as meaning that a trailing space is the same (visually) as no space. That's the beauty of answers to ascii art challenges. If they look right they are right :-)

      – ElPedro
      Jan 4 at 21:33





















    4














    Powershell, 71 69 bytes



    -2 bytes thanks @Veskah





    $l=$args|% le*
    switch($args|% t*y){'o'{'#'*$l}'r'{" $('%'*($l-2)) "}}


    Less golfed test script:



    $f = {

    $l=$args|% length
    switch($args|% t*y){
    'o'{'#'*$l}
    'r'{" $('%'*($l-2)) "}
    }

    }

    @(

    ,(
    'oreo',
    '####',
    ' %% ',
    '####'
    )
    ,(
    'o',
    '#'
    )
    ,(
    're',
    ' '
    )
    ,(
    'rere',
    ' %% ',
    ' %% '
    )
    ,(
    'oreoorererereoo',
    '###############',
    ' %%%%%%%%%%%%% ',
    '###############',
    '###############',
    ' %%%%%%%%%%%%% ',
    ' %%%%%%%%%%%%% ',
    ' %%%%%%%%%%%%% ',
    ' %%%%%%%%%%%%% ',
    '###############',
    '###############'
    )

    ) | % {
    $s,$expected = $_
    $result = &$f $s
    "$result"-eq"$expected"
    # $result # uncomment this line to display a result
    }


    Output:



    True
    True
    True
    True
    True





    share|improve this answer





















    • 1





      Looks like you don't need parens around the $args 69 bytes

      – Veskah
      Jan 4 at 23:30






    • 1





      The length of [string] is an [int]... The [int] is [int] if the array contains one element only. Great! Thanks!

      – mazzy
      Jan 5 at 8:55





















    4














    Mathematica, 111 91 bytes



    #~StringReplace~{"o"->"O"~Table~(n=StringLength@#)<>"n","re"->" "<>Table["R",n-2]<>" n"}&


    Try It Online!



    This was majorly shortened thanks to Misha's edits.





    My original code:



    (z=StringRepeat;n=StringLength@#;#~StringReplace~{"o"->"O"~z~n<>"n","re"->" "<>If[n>2,z["R",n-2],""]<>" n"})&


    This code is not very fancy but it seems too expensive to convert away from strings and then back or to do anything else clever.



    In particular, with only 3-4 commands that have the name String, my original approach couldn't save bytes at all by trying to abstract that away. For example, the following is 129 bytes:



    (w=Symbol["String"<>#]&;z=w@"Repeat";n=w["Length"]@#;#~w@"Replace"~{"o"->"O"~z~n<>"n","re"->" "<>If[n>2,z["R",n-2],""]<>" n"})&





    share|improve this answer





















    • 1





      A few improvements: StringRepeat can be Table since <> will convert the list into a string later; the If is unnecessary since we take the re branch only when n is at least 2; we can save on parentheses by defining n only when we use it. Try it online!

      – Misha Lavrov
      Jan 5 at 20:32











    • @MishaLavrov The If was added because StringRepeat would throw an error on the case of "re"; it doesn't allow you to repeat a string 0 times. Table has no such limitation, so that's a big save!

      – Mark S.
      Jan 5 at 21:33



















    4















    C (gcc), 135 113 109 104 bytes




    • Saved twenty-two twenty-seven bytes thanks to NieDzejkob.

    • Saved four bytes thanks to ceilingcat.


    #define $ putchar(33
    O(char*r){for(char*e,*o=r,x;*r;$-23))for(x=*r++>111,e=x?$-1),r++,o+2:o;*e++;$+x));}


    Try it online!






    share|improve this answer


























    • Shave off a few bytes with -D$=putchar

      – Rogem
      Jan 4 at 13:55











    • 131 bytes if you add a trailing newline as allowed by the rules.

      – NieDzejkob
      Jan 6 at 13:54











    • 127 bytes if you move the e=o to the condition of the first for loop and then remove the else.

      – NieDzejkob
      Jan 6 at 14:20











    • 118 bytes if you choose the cookie and filling characters carefully.

      – NieDzejkob
      Jan 6 at 14:58











    • 113 bytes

      – NieDzejkob
      Jan 6 at 15:02





















    3















    Charcoal, 19 bytes



    Fθ≡ιo⟦⭆θ#⟧e«→P⁻Lθ²↙


    Try it online! Link is to verbose version of code. Explanation:



    Fθ


    Loop through the characters of the input string.



    ≡ι


    Switch on each character.



    o⟦⭆θ#⟧


    If it's an o then print the input string replaced with #s on its own line.



    e«→P⁻Lθ²↙


    If it's an e then move right, print a line of -s that's two less than the length of the input string, then move down and left.






    share|improve this answer































      3















      Perl 5 -p, 47 bytes





      s|o|X x($i=y///c).$/|ge;s|re|$".O x($i-2).$/|ge


      Try it online!






      share|improve this answer
























      • This breaks the rules: "The whitespace padding on each side of the filling is required"

        – NieDzejkob
        Jan 6 at 15:16











      • with some variations tio.run/##K0gtyjH9/…

        – Nahuel Fouilleul
        Jan 7 at 15:16



















      3














      Bash, 87 bytes





      Without sed:



      f(){ printf %$1s|tr   $2;}
      c=${1//o/`f ${#1} B`
      }
      echo "${c//re/ `f $[${#1}-2] F`
      }"


      Thanks to @manatwork.



      With sed (90 bytes):



      f(){ printf %$1s|tr   $2;}
      echo $1|sed "s/o/`f ${#1} B`n/g;s/re/ `f $[${#1}-2] F` n/g"





      share|improve this answer










      New contributor




      Green is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





















      • Could you show us some sample usage? I'm a bit confused by your function expecting 2 parameters.

        – manatwork
        Jan 6 at 18:34













      • You write that into a script called test.sh. Then, you call test.sh from the command line as follows: bash test.sh oreoorererereoo. f is needed to repeat the character $2 $1 number of times

        – Green
        Jan 6 at 18:41













      • Oops. I completely misunderstood function f. Some further minor changes could be made there: Try it online!

        – manatwork
        Jan 6 at 18:55






      • 1





        75 bytes.

        – Dennis
        Jan 7 at 4:15






      • 1





        60 bytes

        – Nahuel Fouilleul
        Jan 8 at 8:27



















      3















      C# (Visual C# Interactive Compiler), 71 bytes





      s=>s.Aggregate("",(a,c)=>a+(c>111?" ":"n".PadLeft(s.Length+c/5-21,c)))


      Try it online!



      Borrowed some ideas from on Embodiment of Ignorance's answer for sure.



      -6 bytes thanks to @ASCIIOnly!



      The overall concept is to compute a string aggregate over the input characters following these rules:




      • If an r is encountered, append a single space character for indentation. We know the next character will be an e.

      • If an o or an e is encountered, generate a string by repeating the current character a specific number of times and prepending it to a newline or some padding and a newline.

      • The number of times to repeat is determined by length of input string and whether the current line is indented.

      • The PadLeft function is used to generate the repeating character string.


      The result is the concatenation of all of these strings.






      share|improve this answer





















      • 1





        71

        – ASCII-only
        Jan 5 at 1:09











      • @ASCIIOnly - Thanks :)

        – dana
        Jan 5 at 1:57











      • > The whitespace padding on each side of the filling is required

        – ASCII-only
        Jan 5 at 4:57






      • 1





        85?

        – ASCII-only
        Jan 5 at 5:01











      • I didn't notice that :) Although, in reviewing the posted answers about 1/2 have done this incorrectly as well. Good catch though!

        – dana
        Jan 5 at 5:08



















      3















      Perl 6, 37 bytes





      {m:g/o|r/>>.&({S/rr/ /.say}o*x.comb)}


      Try it online!



      Anonymous code block that takes a string and prints the oreo, with o as the cookie and r as the cream.



      Explanation:



      {                                   }   # Anonymous code block
      m:g/o|r/ # Select all o s and r s
      >>.&( ) # Map each letter to
      *x.comb # The letter padded to the width
      S/rr/ / # Substitute a leading rr with a space
      .say # And print with a newline





      share|improve this answer































        3














        Java 11, 110 bytes





        s->{int l=s.length();return s.replace("re"," "+"~".repeat(l-(l<2?1:2))+"n").replace("o","=".repeat(l)+"n");}


        Uses = for the cookie and ~ for the filling.



        Try it online.



        Explanation:



        s->{                       // Method with String as both parameter and return-type
        int l=s.length(); // Get the length of the input
        return s // Return the input
        .replace("re", // After we've replaced all "re" with:
        " " // A space
        +"~".repeat(l-(l<2?1:2))
        // Appended with length-2 amount of "~"
        // (or length-1 if the input-length was 1)
        +"n") // Appended with a newline
        .replace("o", // And we've also replaced all "o" with:
        "=".repeat(l) // Length amount of "="
        +"n");} // Appended with a newline




        The above solution uses a replace. The following maps over the characters of the input instead:



        Java 11, 113 112 bytes



        s->s.chars().forEach(c->{if(c>101)System.out.println((c>111?" ":"")+(""+(char)c).repeat(s.length()-2*(~c&1)));})


        -1 byte thanks to @Neil.



        Try it online.



        Explanation:



        s->                           // Method with String parameter and no return-type
        s.chars().forEach(c->{ // Loop over the characters as codepoint-integers
        if(c>101) // If it's not an 'e':
        System.out.println( // Print with trailing newline:
        (c>111? // If it's an 'r'
        " " // Start with a space
        : // Else (it's an 'o' instead)
        "") // Start with an empty string
        +(""+(char)c).repeat( // And append the character itself
        .repeat( // Repeated the following amount of times:
        s.length() // The input-length
        -2*(~c&1)));}) // Minus 2 if it's an "r", or 0 if it's an "o"





        share|improve this answer





















        • 1





          Can you use ~c&1?

          – Neil
          Jan 4 at 11:34











        • @Neil I indeed can, thanks.

          – Kevin Cruijssen
          Jan 4 at 11:57











        • This is invalid: "The whitespace padding on each side of the filling is required"

          – NieDzejkob
          Jan 6 at 15:15











        • @NieDzejkob Fixed.. Always nice to have changing specs during the challenge, sigh..

          – Kevin Cruijssen
          Jan 7 at 9:43











        • @KevinCruijssen not anymore :P

          – ASCII-only
          Jan 7 at 23:32



















        3















        PHP, 100 99 93 bytes





        $l=strlen($i=$argv[1]);$r=str_repeat;echo strtr($i,[o=>$r(X,$l)."
        ",re=>' '.$r(o,$l-2)."
        "]);


        Try it online!



        OUCH. PHP's waaaay_too_long function names strike again!



        Output:



        $php oreo.php oreo
        XXXX
        oo
        XXXX

        $php oreo.php o
        X

        $php oreo.php rere
        oo
        oo

        $ php oreo.php oreoorererereoo
        XXXXXXXXXXXXXXX
        ooooooooooooo
        XXXXXXXXXXXXXXX
        XXXXXXXXXXXXXXX
        ooooooooooooo
        ooooooooooooo
        ooooooooooooo
        ooooooooooooo
        XXXXXXXXXXXXXXX
        XXXXXXXXXXXXXXX





        share|improve this answer


























        • Invalid, cream lines need a trailing space

          – ASCII-only
          Jan 5 at 5:03











        • Fixed the trailing space. Thanks!

          – gwaugh
          Jan 5 at 12:09






        • 1





          Oh boy, PHP! Also any trailing whitespace is now optional, there were enough people that pointed out that since it's printing out ascii it shouldn't really be required.

          – GammaGames
          Jan 7 at 3:26



















        3















        PHP, 96 87 85 bytes



        Thanks to @gwaugh -9 Bytes

        Thanks to @manatwork -2 Bytes





        <?=strtr($i=$argv[1],[o=>($r=str_repeat)(X,$l=strlen($i))."
        ",re=>" {$r(o,$l-2)}
        "]);


        Try it online!



        Try it online! (87 Bytes)



        Try it online (original 97 bytes submition)!




        And a recursive function


        PHP, 135 bytes





        function f($w,$x=0){$f=str_repeat;echo($x<($l=strlen($w)))?($w[$x]=='o')?$f(█,$l)."
        ".f($w,$x+1):" ".$f(░,$l-2)."
        ".f($w,$x+2):"";}


        Try it online! (recursive)






        share|improve this answer





















        • 1





          by combining the best of our two submissions I was able to get it down to 87 bytes TIO. Would you be game to go in with this as a collaborative submission? :)

          – gwaugh
          2 days ago








        • 1





          I think we can remove 1 more byte by using the command short_tag_open, and instead of <?= we can use <?, or am i mistaken?

          – Francisco Hahn
          2 days ago






        • 1





          2 characters shorter with string interpolation: ' '.$r(o,$l-2)."␤"" {$r(o,$l-2)}␤".

          – manatwork
          2 days ago











        • Thanks @manatwork sometimes i forgot php vars are evaluated in a string if the entire string is declared with "" istead of ''

          – Francisco Hahn
          2 days ago



















        3














        JavaScript, 72 65 64 bytes



        s=>s.replace(/.e?/g,([x,y])=>(y?`
        `:`
        `).padEnd(s.length+!y,x))


        Try it online






        share|improve this answer

































          2















          C# (.NET Core), 143 bytes



          Without LINQ.





          p=>{var q="";foreach(char c in p){if(c!='e'){for(var j=0;j<p.Length;j++)q+=(j<1|j>p.Length-2)&c>'q'?" ":c<'p'?"█":"░";q+="n";}}return q;};


          Try it online!






          share|improve this answer































            2















            Clojure, 137 bytes





            (fn[f](let[w(count f)r #(apply str(repeat % %2))](clojure.string/join"n"(replace{o(r w #)e(str  (r(- w 2)-)  )}(remove #{r}f)))))


            I'm not using the nice characters in the printout in the golfed version since those are expensive. Returns a string to be printed.



            Try it online!



            See below for explanation.



            Pre-golfed:



            ; Backslashes indicate a character literal
            (defn oreo [format-str]
            (let [width (count format-str)

            ; A helper function since Clojure doesn't have built-in string multiplication
            str-repeat #(apply str (repeat % %2))

            ; Define the layers
            cookie (str-repeat width █)
            cream (str (str-repeat (- width 2) ░) )]

            (->> format-str ; Take the input string,
            (remove #{r}) ; remove r for simplcity,
            (replace {o cookie, e cream}) ; replace the remaining letters with the layers,
            (clojure.string/join "n")))) ; and join the layers together with newlines





            share|improve this answer































              2















              Dart, 120 106 107 bytes



              f(s)=>s.replaceAll('o',''.padRight(s.length,'#')+'n').replaceAll('re',' '.padRight(s.length-1,'-')+' n');


              Try it online!




              • +1 byte : Added trailing whitespace






              share|improve this answer


























              • This is invalid: "The whitespace padding on each side of the filling is required"

                – NieDzejkob
                Jan 6 at 15:15











              • Oh, never mind then, I'll correct it soon. Thanks for the info, I missed it

                – Elcan
                Jan 6 at 22:14



















              2















              Python 2, 77 76 72 bytes





              lambda i:'n'.join((x*len(i),' '+x*(len(i)-2))[x>'o']for x in i if'e'<x)


              Try it online!



              The outer part of the cookie is 'o' and the filling is 'r'.






              share|improve this answer


























              • 68 bytes. Although I doubt if you can really omit the trailing spaces, the spec does say "The whitespace padding on each side of the filling is required"...

                – Erik the Outgolfer
                Jan 5 at 22:35











              • Thanks @EriktheOutgolfer. Thought a lambda would be shorter! Guess in this case not. Had missed the requirement about the mandatory trailing space on the filling. Really can't see the point with an ascii art challenge but if that's what OP requires then I guess my answer is invalid anyway.

                – ElPedro
                Jan 6 at 0:13











              • Now corrected...

                – ElPedro
                Jan 6 at 0:18











              • Why bring it back to 76? Just put +' ' after (l-2). Also, you have a typo, *' ' must be +' '.

                – Erik the Outgolfer
                Jan 6 at 0:23













              • That's what I did with my current solution. Will take a closer look at your hints tomorrow (later today). It's late here and I have been shoveling snow all day so too tired for golf. Thanks for the tips though :)

                – ElPedro
                Jan 6 at 0:27



















              2














              x86-64 machine code (Linux), 97 bytes



              0000000000000000 <oreo_asm>:
              0: 56 push %rsi
              1: 57 push %rdi

              0000000000000002 <len>:
              2: 48 ff c7 inc %rdi
              5: 80 3f 00 cmpb $0x0,(%rdi)
              8: 75 f8 jne 2 <len>
              a: 49 89 fc mov %rdi,%r12
              d: 5f pop %rdi
              e: 49 29 fc sub %rdi,%r12
              11: 4d 31 f6 xor %r14,%r14
              14: eb 18 jmp 2e <outer_loop.skip>

              0000000000000016 <extra>:
              16: 41 c6 01 20 movb $0x20,(%r9)
              1a: c6 03 20 movb $0x20,(%rbx)
              1d: 49 ff ce dec %r14
              20: eb 06 jmp 28 <outer_loop>

              0000000000000022 <newline>:
              22: c6 06 0a movb $0xa,(%rsi)
              25: 48 ff c6 inc %rsi

              0000000000000028 <outer_loop>:
              28: 49 ff c6 inc %r14
              2b: 48 ff c7 inc %rdi

              000000000000002e <outer_loop.skip>:
              2e: 44 8a 07 mov (%rdi),%r8b
              31: 41 80 f8 65 cmp $0x65,%r8b
              35: 74 df je 16 <extra>
              37: 45 84 c0 test %r8b,%r8b
              3a: 74 23 je 5f <done>
              3c: 48 89 f3 mov %rsi,%rbx

              000000000000003f <inner_loop>:
              3f: 44 88 06 mov %r8b,(%rsi)
              42: 49 89 f1 mov %rsi,%r9
              45: 48 ff c6 inc %rsi
              48: 48 31 d2 xor %rdx,%rdx
              4b: 48 89 f0 mov %rsi,%rax
              4e: 48 2b 04 24 sub (%rsp),%rax
              52: 4c 29 f0 sub %r14,%rax
              55: 49 f7 f4 div %r12
              58: 48 85 d2 test %rdx,%rdx
              5b: 74 c5 je 22 <newline>
              5d: eb e0 jmp 3f <inner_loop>

              000000000000005f <done>:
              5f: 5e pop %rsi
              60: c3 retq


              This x86-64 function takes in the pointer to the input string in rsi and builds the output starting at the pointer in rdi (these are the registers used to pass the first two arguments from a C function on Linux). For convenience, I've written a C++ wrapper for this which also does nice input sanitization and prints the output. That code can be located here. This also shows the original nasm syntax assembly I wrote for this function (as well as the non-golfed version I got working first).



              A few things to note is that this code doesn't respect any callee saved registers, which means that the C++ code likely will crash if run for a while after calling this function. On my machine it doesn't, but that's rather surprising. I also don't add a null byte to delimit the output string, and instead the space allocated for the output string is pre-filled with bytes. (If this isn't allowed I can add the null terminator at a cost of 3 bytes).



              The logic for this code is essentially counting the length of the string, then building a line of this length for each 'o' and 'r' characters seen in the input string, and then for any 'e' character seen, replacing the first and last characters on the previous line with space characters.



              I can't find anywhere online to compile and run a mix of C++ and nasm source code, so I might write some small wrapper code for this to prove it works. Otherwise you should be able to compile and run this with the makefile in the link I gave with the command:



              $ make oreo ASM_FILE=oreo_golf.nasm
              $ ./oreo oreoorererereoo --use_asm


              I was able to format the assembly to something acceptable by gcc, so try it online!






              share|improve this answer





















              • 1





                Oh my, now this is an entry!

                – GammaGames
                Jan 8 at 15:09



















              2















              Pyth, 28 bytes



              FNzIqN"o"*lzN)IqN"r"+d*-lz2N
              FNz For each value, N, in input
              IqN"o" if the character is "o"
              *lzN return the character times the length of the input
              ) end if
              IqN"r" if the character is "r"
              FNzIqN"o"*lzN)IqN"r"+d*-lz2N
              *-lz2N return the character times length - 2
              +d padded on the left with " "


              Try it here! This one uses a loop.



              Pyth, 30 bytes



              (As string replace)



              ::z"o"+*lz"="b"re"++d*-lz2"~"b
              :z"o" With the input, replace "o" with
              *lz"=" "=" times the length of the input
              + b and a newline added to the end
              : "re" With the input, replace "re" with
              * "~" "~" times
              -lz2 the length of the input minus 2
              +d padded on the left with " "
              + b and a newline added to the end


              Try it here! This one uses string replacement.



              I really like python (it's what I wrote my original test scripts in), so I thought I'd do a pyth entry for fun :)






              share|improve this answer





















              • 1





                Isn't this 37 bytes? I thought Pyth uses default ASCII as its codepage just like Python, if I remember correctly. So even though your code is 33 characters, both and are three bytes each. Or am I missing something here?

                – Kevin Cruijssen
                Jan 4 at 7:05











              • Good call, I didn't realize that (I couldn't get pyth to work on tio.run, so I used the length counter on the herokuapp page). In the for loop I could just replace the character with N, even saving a few bytes!

                – GammaGames
                Jan 4 at 14:38











              • Thought something like that happened. :) I once had the same issue with a 05AB1E answer of mine that was using characters outside its code page. Unfortunately TIO displays chars and bytes the same for most golfing languages. For Java or Python TIO will correctly state 33 chars, 37 bytes, but not in golfing languages on TIO. But in your solutions just changing those characters indeed fixes the issue, so it's not that big of a deal here.

                – Kevin Cruijssen
                Jan 4 at 14:41













              • @KevinCruijssen Wait, 05AB1E doesn't use an actual SBCS?

                – ASCII-only
                Jan 6 at 1:08






              • 1





                If you're interested, it seems to work effortlessly on TIO for me.

                – NieDzejkob
                2 days ago



















              2















              Ruby, 62 60 bytes





              ->s{s.gsub /./,?r=>" #{(?**z=s.size)[0..-3]}
              ",?o=>?O*z+?n}


              Try it online!



              Uses O for the cookie, * for the filling.



              -1 thanks to @manatwork pointing out a silly mistake and another -1 due to relaxation of the rules about whitespaces.






              share|improve this answer


























              • No need for parenthesis around .gsub's parameters.

                – manatwork
                2 days ago















              1 2
              next



              Your Answer





              StackExchange.ifUsing("editor", function () {
              return StackExchange.using("mathjaxEditing", function () {
              StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
              StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
              });
              });
              }, "mathjax-editing");

              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "200"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f178344%2foreoorererereoo%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              41 Answers
              41






              active

              oldest

              votes








              41 Answers
              41






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              1 2
              next










              13















              Jelly,  16 14  13 bytes



              -1 Thanks to Erik the Outgolfer



              OḂƇẒṁ€aØ.¦€⁶Y


              Uses 1 for the cream and 0 for the cookie.



              Try it online!



              How?



              OḂƇẒṁ€aØ.¦€⁶Y - Main Link: list of characters, V    e.g. 'orereo'
              O - ordinal (vectorises) [111,114,101,114,101,111]
              Ƈ - filter keep those for which:
              Ḃ - modulo 2 [111, 101, 101,111]
              Ẓ - is prime? (vectorises) [ 0, 1, 1, 0]
              ṁ€ - mould each like V [[0,0,0,0,0,0],[1,1,1,1,1,1],[1,1,1,1,1,1],[0,0,0,0,0,0]]
              € - for each:
              ¦ - sparse application...
              Ø. - ...to indices: literal [0,1] (0 is the rightmost index, 1 is the leftmost)
              a - ...apply: logical AND with:
              ⁶ - space character [[0,0,0,0,0,0],[' ',1,1,1,1,' '],[' ',1,1,1,1,' '],[0,0,0,0,0,0]]
              Y - join with newline characters [0,0,0,0,0,0,'n',' ',1,1,1,1,' ','n',' ',1,1,1,1,' ','n',0,0,0,0,0,0]
              - implicit print ...smashes everything together:
              - 000000
              - 1111
              - 1111
              - 000000




              Previous 16 byter:



              ḟ”eẋ€Ly@Ø.¦€⁾r Y


              Uses r for the cream and o for the cookie.



              Try it online!






              share|improve this answer


























              • I was hoping for a Jelly entry, such an interesting language!

                – GammaGames
                Jan 4 at 17:39
















              13















              Jelly,  16 14  13 bytes



              -1 Thanks to Erik the Outgolfer



              OḂƇẒṁ€aØ.¦€⁶Y


              Uses 1 for the cream and 0 for the cookie.



              Try it online!



              How?



              OḂƇẒṁ€aØ.¦€⁶Y - Main Link: list of characters, V    e.g. 'orereo'
              O - ordinal (vectorises) [111,114,101,114,101,111]
              Ƈ - filter keep those for which:
              Ḃ - modulo 2 [111, 101, 101,111]
              Ẓ - is prime? (vectorises) [ 0, 1, 1, 0]
              ṁ€ - mould each like V [[0,0,0,0,0,0],[1,1,1,1,1,1],[1,1,1,1,1,1],[0,0,0,0,0,0]]
              € - for each:
              ¦ - sparse application...
              Ø. - ...to indices: literal [0,1] (0 is the rightmost index, 1 is the leftmost)
              a - ...apply: logical AND with:
              ⁶ - space character [[0,0,0,0,0,0],[' ',1,1,1,1,' '],[' ',1,1,1,1,' '],[0,0,0,0,0,0]]
              Y - join with newline characters [0,0,0,0,0,0,'n',' ',1,1,1,1,' ','n',' ',1,1,1,1,' ','n',0,0,0,0,0,0]
              - implicit print ...smashes everything together:
              - 000000
              - 1111
              - 1111
              - 000000




              Previous 16 byter:



              ḟ”eẋ€Ly@Ø.¦€⁾r Y


              Uses r for the cream and o for the cookie.



              Try it online!






              share|improve this answer


























              • I was hoping for a Jelly entry, such an interesting language!

                – GammaGames
                Jan 4 at 17:39














              13












              13








              13








              Jelly,  16 14  13 bytes



              -1 Thanks to Erik the Outgolfer



              OḂƇẒṁ€aØ.¦€⁶Y


              Uses 1 for the cream and 0 for the cookie.



              Try it online!



              How?



              OḂƇẒṁ€aØ.¦€⁶Y - Main Link: list of characters, V    e.g. 'orereo'
              O - ordinal (vectorises) [111,114,101,114,101,111]
              Ƈ - filter keep those for which:
              Ḃ - modulo 2 [111, 101, 101,111]
              Ẓ - is prime? (vectorises) [ 0, 1, 1, 0]
              ṁ€ - mould each like V [[0,0,0,0,0,0],[1,1,1,1,1,1],[1,1,1,1,1,1],[0,0,0,0,0,0]]
              € - for each:
              ¦ - sparse application...
              Ø. - ...to indices: literal [0,1] (0 is the rightmost index, 1 is the leftmost)
              a - ...apply: logical AND with:
              ⁶ - space character [[0,0,0,0,0,0],[' ',1,1,1,1,' '],[' ',1,1,1,1,' '],[0,0,0,0,0,0]]
              Y - join with newline characters [0,0,0,0,0,0,'n',' ',1,1,1,1,' ','n',' ',1,1,1,1,' ','n',0,0,0,0,0,0]
              - implicit print ...smashes everything together:
              - 000000
              - 1111
              - 1111
              - 000000




              Previous 16 byter:



              ḟ”eẋ€Ly@Ø.¦€⁾r Y


              Uses r for the cream and o for the cookie.



              Try it online!






              share|improve this answer
















              Jelly,  16 14  13 bytes



              -1 Thanks to Erik the Outgolfer



              OḂƇẒṁ€aØ.¦€⁶Y


              Uses 1 for the cream and 0 for the cookie.



              Try it online!



              How?



              OḂƇẒṁ€aØ.¦€⁶Y - Main Link: list of characters, V    e.g. 'orereo'
              O - ordinal (vectorises) [111,114,101,114,101,111]
              Ƈ - filter keep those for which:
              Ḃ - modulo 2 [111, 101, 101,111]
              Ẓ - is prime? (vectorises) [ 0, 1, 1, 0]
              ṁ€ - mould each like V [[0,0,0,0,0,0],[1,1,1,1,1,1],[1,1,1,1,1,1],[0,0,0,0,0,0]]
              € - for each:
              ¦ - sparse application...
              Ø. - ...to indices: literal [0,1] (0 is the rightmost index, 1 is the leftmost)
              a - ...apply: logical AND with:
              ⁶ - space character [[0,0,0,0,0,0],[' ',1,1,1,1,' '],[' ',1,1,1,1,' '],[0,0,0,0,0,0]]
              Y - join with newline characters [0,0,0,0,0,0,'n',' ',1,1,1,1,' ','n',' ',1,1,1,1,' ','n',0,0,0,0,0,0]
              - implicit print ...smashes everything together:
              - 000000
              - 1111
              - 1111
              - 000000




              Previous 16 byter:



              ḟ”eẋ€Ly@Ø.¦€⁾r Y


              Uses r for the cream and o for the cookie.



              Try it online!







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jan 6 at 0:39

























              answered Jan 4 at 17:31









              Jonathan AllanJonathan Allan

              51k534166




              51k534166













              • I was hoping for a Jelly entry, such an interesting language!

                – GammaGames
                Jan 4 at 17:39



















              • I was hoping for a Jelly entry, such an interesting language!

                – GammaGames
                Jan 4 at 17:39

















              I was hoping for a Jelly entry, such an interesting language!

              – GammaGames
              Jan 4 at 17:39





              I was hoping for a Jelly entry, such an interesting language!

              – GammaGames
              Jan 4 at 17:39











              17





              +50










              Pepe, 364 bytes



              Unfortunately the online interpreter does not take care of compressing comments, hence all o characters will be replaced by a space.. Neither the spaces nor the o are necessary, so this could be 295 bytes, but I like it more this way:





              rEeEEeeEeEororEEoreoreeeEeeeeeorEEEEeoREeoreorEeEEeEEEEororEEoreorEEEEEoREeoreorEeEEEeeEeororEEoreoReoREoREEEeoREEEEEoreorEorEEEeorEEEEEoreEoREeoreoREEeoREEEEeEeeoREEEeoREeeEoREEEeoREEEEEEEorEEEeEorEEEeoREoREEEeoREEEEEoREEoReoreorEEEeEoREEEEEEeorEEEeoReEoREoREEEeoREEoReoroReEeoREoREEEeorEEEEeoReeoREEEeoREeeEoREEEeoREEEEEEEoreoReoReoREoREEEeoREEEEEoreeeeeEeEeoRee


              Try it online!



              Ungolfed



              There might be some golfing oppurtunities with flags which I missed, but I'm done for now:



              # "function" for 'e'
              rEeEEeeEeE rrEE
              re # remove duplicated argument
              reeeEeeeee # print space
              rEEEEe # decrement counter twice
              REe re

              # "function" for 'o'
              rEeEEeEEEE rrEE
              re # remove duplicated argument
              rEEEEE # increment counter
              REe re

              # "function for 'r'
              rEeEEEeeEe rrEE
              re Re # remove duplicated argument & char
              RE REEEe REEEEE # push 1
              re rE rEEEe rEEEEE # replace 1
              reE # goto 1
              REe re

              # Main

              REEe REEEEeEee # read input & reverse
              REEEe REeeE REEEe REEEEEEE # push length-1 & move to r

              rEEEeE rEEEe # dummy loop-var (fucking do-whiles...)
              RE REEEe REEEEE REE # while [label-1]

              # Call the right procedure depending on current character,
              # sets stacks up as follows:
              # R [ .... *currentChar ]
              # r [ (N-1) *count ]
              Re re # pop 1 & loop-counter
              rEEEeE # duplicate counter
              REEEEEEe rEEEe # copy current char to other stack
              ReE # jeq to 'o'-label or 'e'-label

              # Output currentChar count times:
              RE REEEe REE # while [label-0]:
              Re # pop 0
              rReEe # print character
              RE REEEe # push 0
              rEEEEe # decrement counter
              Ree

              REEEe REeeE REEEe REEEEEEE # push length-1 & move to r
              re Re Re # pop 0, counter and 9((((currentChar
              RE REEEe REEEEE # push 1
              reeeeeEeEe # print new-line

              Ree





              share|improve this answer





















              • 1





                I moved this conversation to chat for you.

                – DJMcMayhem
                2 days ago


















              17





              +50










              Pepe, 364 bytes



              Unfortunately the online interpreter does not take care of compressing comments, hence all o characters will be replaced by a space.. Neither the spaces nor the o are necessary, so this could be 295 bytes, but I like it more this way:





              rEeEEeeEeEororEEoreoreeeEeeeeeorEEEEeoREeoreorEeEEeEEEEororEEoreorEEEEEoREeoreorEeEEEeeEeororEEoreoReoREoREEEeoREEEEEoreorEorEEEeorEEEEEoreEoREeoreoREEeoREEEEeEeeoREEEeoREeeEoREEEeoREEEEEEEorEEEeEorEEEeoREoREEEeoREEEEEoREEoReoreorEEEeEoREEEEEEeorEEEeoReEoREoREEEeoREEoReoroReEeoREoREEEeorEEEEeoReeoREEEeoREeeEoREEEeoREEEEEEEoreoReoReoREoREEEeoREEEEEoreeeeeEeEeoRee


              Try it online!



              Ungolfed



              There might be some golfing oppurtunities with flags which I missed, but I'm done for now:



              # "function" for 'e'
              rEeEEeeEeE rrEE
              re # remove duplicated argument
              reeeEeeeee # print space
              rEEEEe # decrement counter twice
              REe re

              # "function" for 'o'
              rEeEEeEEEE rrEE
              re # remove duplicated argument
              rEEEEE # increment counter
              REe re

              # "function for 'r'
              rEeEEEeeEe rrEE
              re Re # remove duplicated argument & char
              RE REEEe REEEEE # push 1
              re rE rEEEe rEEEEE # replace 1
              reE # goto 1
              REe re

              # Main

              REEe REEEEeEee # read input & reverse
              REEEe REeeE REEEe REEEEEEE # push length-1 & move to r

              rEEEeE rEEEe # dummy loop-var (fucking do-whiles...)
              RE REEEe REEEEE REE # while [label-1]

              # Call the right procedure depending on current character,
              # sets stacks up as follows:
              # R [ .... *currentChar ]
              # r [ (N-1) *count ]
              Re re # pop 1 & loop-counter
              rEEEeE # duplicate counter
              REEEEEEe rEEEe # copy current char to other stack
              ReE # jeq to 'o'-label or 'e'-label

              # Output currentChar count times:
              RE REEEe REE # while [label-0]:
              Re # pop 0
              rReEe # print character
              RE REEEe # push 0
              rEEEEe # decrement counter
              Ree

              REEEe REeeE REEEe REEEEEEE # push length-1 & move to r
              re Re Re # pop 0, counter and 9((((currentChar
              RE REEEe REEEEE # push 1
              reeeeeEeEe # print new-line

              Ree





              share|improve this answer





















              • 1





                I moved this conversation to chat for you.

                – DJMcMayhem
                2 days ago
















              17





              +50







              17





              +50



              17




              +50






              Pepe, 364 bytes



              Unfortunately the online interpreter does not take care of compressing comments, hence all o characters will be replaced by a space.. Neither the spaces nor the o are necessary, so this could be 295 bytes, but I like it more this way:





              rEeEEeeEeEororEEoreoreeeEeeeeeorEEEEeoREeoreorEeEEeEEEEororEEoreorEEEEEoREeoreorEeEEEeeEeororEEoreoReoREoREEEeoREEEEEoreorEorEEEeorEEEEEoreEoREeoreoREEeoREEEEeEeeoREEEeoREeeEoREEEeoREEEEEEEorEEEeEorEEEeoREoREEEeoREEEEEoREEoReoreorEEEeEoREEEEEEeorEEEeoReEoREoREEEeoREEoReoroReEeoREoREEEeorEEEEeoReeoREEEeoREeeEoREEEeoREEEEEEEoreoReoReoREoREEEeoREEEEEoreeeeeEeEeoRee


              Try it online!



              Ungolfed



              There might be some golfing oppurtunities with flags which I missed, but I'm done for now:



              # "function" for 'e'
              rEeEEeeEeE rrEE
              re # remove duplicated argument
              reeeEeeeee # print space
              rEEEEe # decrement counter twice
              REe re

              # "function" for 'o'
              rEeEEeEEEE rrEE
              re # remove duplicated argument
              rEEEEE # increment counter
              REe re

              # "function for 'r'
              rEeEEEeeEe rrEE
              re Re # remove duplicated argument & char
              RE REEEe REEEEE # push 1
              re rE rEEEe rEEEEE # replace 1
              reE # goto 1
              REe re

              # Main

              REEe REEEEeEee # read input & reverse
              REEEe REeeE REEEe REEEEEEE # push length-1 & move to r

              rEEEeE rEEEe # dummy loop-var (fucking do-whiles...)
              RE REEEe REEEEE REE # while [label-1]

              # Call the right procedure depending on current character,
              # sets stacks up as follows:
              # R [ .... *currentChar ]
              # r [ (N-1) *count ]
              Re re # pop 1 & loop-counter
              rEEEeE # duplicate counter
              REEEEEEe rEEEe # copy current char to other stack
              ReE # jeq to 'o'-label or 'e'-label

              # Output currentChar count times:
              RE REEEe REE # while [label-0]:
              Re # pop 0
              rReEe # print character
              RE REEEe # push 0
              rEEEEe # decrement counter
              Ree

              REEEe REeeE REEEe REEEEEEE # push length-1 & move to r
              re Re Re # pop 0, counter and 9((((currentChar
              RE REEEe REEEEE # push 1
              reeeeeEeEe # print new-line

              Ree





              share|improve this answer
















              Pepe, 364 bytes



              Unfortunately the online interpreter does not take care of compressing comments, hence all o characters will be replaced by a space.. Neither the spaces nor the o are necessary, so this could be 295 bytes, but I like it more this way:





              rEeEEeeEeEororEEoreoreeeEeeeeeorEEEEeoREeoreorEeEEeEEEEororEEoreorEEEEEoREeoreorEeEEEeeEeororEEoreoReoREoREEEeoREEEEEoreorEorEEEeorEEEEEoreEoREeoreoREEeoREEEEeEeeoREEEeoREeeEoREEEeoREEEEEEEorEEEeEorEEEeoREoREEEeoREEEEEoREEoReoreorEEEeEoREEEEEEeorEEEeoReEoREoREEEeoREEoReoroReEeoREoREEEeorEEEEeoReeoREEEeoREeeEoREEEeoREEEEEEEoreoReoReoREoREEEeoREEEEEoreeeeeEeEeoRee


              Try it online!



              Ungolfed



              There might be some golfing oppurtunities with flags which I missed, but I'm done for now:



              # "function" for 'e'
              rEeEEeeEeE rrEE
              re # remove duplicated argument
              reeeEeeeee # print space
              rEEEEe # decrement counter twice
              REe re

              # "function" for 'o'
              rEeEEeEEEE rrEE
              re # remove duplicated argument
              rEEEEE # increment counter
              REe re

              # "function for 'r'
              rEeEEEeeEe rrEE
              re Re # remove duplicated argument & char
              RE REEEe REEEEE # push 1
              re rE rEEEe rEEEEE # replace 1
              reE # goto 1
              REe re

              # Main

              REEe REEEEeEee # read input & reverse
              REEEe REeeE REEEe REEEEEEE # push length-1 & move to r

              rEEEeE rEEEe # dummy loop-var (fucking do-whiles...)
              RE REEEe REEEEE REE # while [label-1]

              # Call the right procedure depending on current character,
              # sets stacks up as follows:
              # R [ .... *currentChar ]
              # r [ (N-1) *count ]
              Re re # pop 1 & loop-counter
              rEEEeE # duplicate counter
              REEEEEEe rEEEe # copy current char to other stack
              ReE # jeq to 'o'-label or 'e'-label

              # Output currentChar count times:
              RE REEEe REE # while [label-0]:
              Re # pop 0
              rReEe # print character
              RE REEEe # push 0
              rEEEEe # decrement counter
              Ree

              REEEe REeeE REEEe REEEEEEE # push length-1 & move to r
              re Re Re # pop 0, counter and 9((((currentChar
              RE REEEe REEEEE # push 1
              reeeeeEeEe # print new-line

              Ree






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited 2 days ago









              RedClover

              524525




              524525










              answered Jan 5 at 0:41









              BMOBMO

              11.8k22188




              11.8k22188








              • 1





                I moved this conversation to chat for you.

                – DJMcMayhem
                2 days ago
















              • 1





                I moved this conversation to chat for you.

                – DJMcMayhem
                2 days ago










              1




              1





              I moved this conversation to chat for you.

              – DJMcMayhem
              2 days ago







              I moved this conversation to chat for you.

              – DJMcMayhem
              2 days ago













              9















              Canvas, 19 18 17 bytes



              e ∙╋
              :r≠*┤];L×⁸↔⁸


              Try it here!



              Uses the annoyingly long code of :r≠*┤] to remove rs from the input..






              share|improve this answer


























              • That's a handy feature, and cool language!

                – GammaGames
                Jan 4 at 1:48
















              9















              Canvas, 19 18 17 bytes



              e ∙╋
              :r≠*┤];L×⁸↔⁸


              Try it here!



              Uses the annoyingly long code of :r≠*┤] to remove rs from the input..






              share|improve this answer


























              • That's a handy feature, and cool language!

                – GammaGames
                Jan 4 at 1:48














              9












              9








              9








              Canvas, 19 18 17 bytes



              e ∙╋
              :r≠*┤];L×⁸↔⁸


              Try it here!



              Uses the annoyingly long code of :r≠*┤] to remove rs from the input..






              share|improve this answer
















              Canvas, 19 18 17 bytes



              e ∙╋
              :r≠*┤];L×⁸↔⁸


              Try it here!



              Uses the annoyingly long code of :r≠*┤] to remove rs from the input..







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Jan 4 at 20:34

























              answered Jan 4 at 1:47









              dzaimadzaima

              14.5k21755




              14.5k21755













              • That's a handy feature, and cool language!

                – GammaGames
                Jan 4 at 1:48



















              • That's a handy feature, and cool language!

                – GammaGames
                Jan 4 at 1:48

















              That's a handy feature, and cool language!

              – GammaGames
              Jan 4 at 1:48





              That's a handy feature, and cool language!

              – GammaGames
              Jan 4 at 1:48











              7















              Japt -R, 16 15 bytes



              re ¬£çX sX²èrÃû


              Try it



                                  :Implicit input of string U
              re :Remove all "e"s
              ¬ :Split to array of characters
              £ :Map each X
              çX : Repeat X to the length of U
              s : Slice from index
              X² : Duplicate X
              èr : Count the occurrences of "r"
              Ã :End map
              û :Centre pad each element with spaces to the length of the longest
              :Implicitly join with newlines and output




              Alternatives



              re ¬ËpUÊaD²èrÃû
              re ¬£îX rr²i^Ãû





              share|improve this answer






























                7















                Japt -R, 16 15 bytes



                re ¬£çX sX²èrÃû


                Try it



                                    :Implicit input of string U
                re :Remove all "e"s
                ¬ :Split to array of characters
                £ :Map each X
                çX : Repeat X to the length of U
                s : Slice from index
                X² : Duplicate X
                èr : Count the occurrences of "r"
                Ã :End map
                û :Centre pad each element with spaces to the length of the longest
                :Implicitly join with newlines and output




                Alternatives



                re ¬ËpUÊaD²èrÃû
                re ¬£îX rr²i^Ãû





                share|improve this answer




























                  7












                  7








                  7








                  Japt -R, 16 15 bytes



                  re ¬£çX sX²èrÃû


                  Try it



                                      :Implicit input of string U
                  re :Remove all "e"s
                  ¬ :Split to array of characters
                  £ :Map each X
                  çX : Repeat X to the length of U
                  s : Slice from index
                  X² : Duplicate X
                  èr : Count the occurrences of "r"
                  Ã :End map
                  û :Centre pad each element with spaces to the length of the longest
                  :Implicitly join with newlines and output




                  Alternatives



                  re ¬ËpUÊaD²èrÃû
                  re ¬£îX rr²i^Ãû





                  share|improve this answer
















                  Japt -R, 16 15 bytes



                  re ¬£çX sX²èrÃû


                  Try it



                                      :Implicit input of string U
                  re :Remove all "e"s
                  ¬ :Split to array of characters
                  £ :Map each X
                  çX : Repeat X to the length of U
                  s : Slice from index
                  X² : Duplicate X
                  èr : Count the occurrences of "r"
                  Ã :End map
                  û :Centre pad each element with spaces to the length of the longest
                  :Implicitly join with newlines and output




                  Alternatives



                  re ¬ËpUÊaD²èrÃû
                  re ¬£îX rr²i^Ãû






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 4 at 14:48

























                  answered Jan 4 at 8:10









                  ShaggyShaggy

                  19.2k21666




                  19.2k21666























                      6















                      C# (Visual C# Interactive Compiler), 95 bytes





                      n=>n.Replace("o",new String('-',n.Length)+"n").Replace("re"," ".PadRight(n.Length-1,'|')+"n")


                      Try it online!



                      Alternative using Aggregate, 108 bytes





                      n=>n.Aggregate("",(d,c)=>d+(c<102?"":c<112?new String('-',n.Length)+"n":" ".PadRight(n.Length-1,'|')+"n"))


                      Try it online!






                      share|improve this answer





















                      • 1





                        now it trims trailing spaces..

                        – dzaima
                        Jan 4 at 1:50











                      • There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                        – GammaGames
                        Jan 4 at 4:40











                      • Your replace doesn't work when the input is o, since the n.Length-2 will result in -1.

                        – Kevin Cruijssen
                        Jan 4 at 10:18











                      • The n.Length-2 is is for when the input has re.

                        – Embodiment of Ignorance
                        Jan 4 at 16:27
















                      6















                      C# (Visual C# Interactive Compiler), 95 bytes





                      n=>n.Replace("o",new String('-',n.Length)+"n").Replace("re"," ".PadRight(n.Length-1,'|')+"n")


                      Try it online!



                      Alternative using Aggregate, 108 bytes





                      n=>n.Aggregate("",(d,c)=>d+(c<102?"":c<112?new String('-',n.Length)+"n":" ".PadRight(n.Length-1,'|')+"n"))


                      Try it online!






                      share|improve this answer





















                      • 1





                        now it trims trailing spaces..

                        – dzaima
                        Jan 4 at 1:50











                      • There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                        – GammaGames
                        Jan 4 at 4:40











                      • Your replace doesn't work when the input is o, since the n.Length-2 will result in -1.

                        – Kevin Cruijssen
                        Jan 4 at 10:18











                      • The n.Length-2 is is for when the input has re.

                        – Embodiment of Ignorance
                        Jan 4 at 16:27














                      6












                      6








                      6








                      C# (Visual C# Interactive Compiler), 95 bytes





                      n=>n.Replace("o",new String('-',n.Length)+"n").Replace("re"," ".PadRight(n.Length-1,'|')+"n")


                      Try it online!



                      Alternative using Aggregate, 108 bytes





                      n=>n.Aggregate("",(d,c)=>d+(c<102?"":c<112?new String('-',n.Length)+"n":" ".PadRight(n.Length-1,'|')+"n"))


                      Try it online!






                      share|improve this answer
















                      C# (Visual C# Interactive Compiler), 95 bytes





                      n=>n.Replace("o",new String('-',n.Length)+"n").Replace("re"," ".PadRight(n.Length-1,'|')+"n")


                      Try it online!



                      Alternative using Aggregate, 108 bytes





                      n=>n.Aggregate("",(d,c)=>d+(c<102?"":c<112?new String('-',n.Length)+"n":" ".PadRight(n.Length-1,'|')+"n"))


                      Try it online!







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 4 at 16:30

























                      answered Jan 4 at 1:47









                      Embodiment of IgnoranceEmbodiment of Ignorance

                      601115




                      601115








                      • 1





                        now it trims trailing spaces..

                        – dzaima
                        Jan 4 at 1:50











                      • There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                        – GammaGames
                        Jan 4 at 4:40











                      • Your replace doesn't work when the input is o, since the n.Length-2 will result in -1.

                        – Kevin Cruijssen
                        Jan 4 at 10:18











                      • The n.Length-2 is is for when the input has re.

                        – Embodiment of Ignorance
                        Jan 4 at 16:27














                      • 1





                        now it trims trailing spaces..

                        – dzaima
                        Jan 4 at 1:50











                      • There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                        – GammaGames
                        Jan 4 at 4:40











                      • Your replace doesn't work when the input is o, since the n.Length-2 will result in -1.

                        – Kevin Cruijssen
                        Jan 4 at 10:18











                      • The n.Length-2 is is for when the input has re.

                        – Embodiment of Ignorance
                        Jan 4 at 16:27








                      1




                      1





                      now it trims trailing spaces..

                      – dzaima
                      Jan 4 at 1:50





                      now it trims trailing spaces..

                      – dzaima
                      Jan 4 at 1:50













                      There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                      – GammaGames
                      Jan 4 at 4:40





                      There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                      – GammaGames
                      Jan 4 at 4:40













                      Your replace doesn't work when the input is o, since the n.Length-2 will result in -1.

                      – Kevin Cruijssen
                      Jan 4 at 10:18





                      Your replace doesn't work when the input is o, since the n.Length-2 will result in -1.

                      – Kevin Cruijssen
                      Jan 4 at 10:18













                      The n.Length-2 is is for when the input has re.

                      – Embodiment of Ignorance
                      Jan 4 at 16:27





                      The n.Length-2 is is for when the input has re.

                      – Embodiment of Ignorance
                      Jan 4 at 16:27











                      6















                      R, 106 bytes





                      function(s,N=nchar(s)){m=rep(el(strsplit(gsub('re',0,s),'')),e=N)
                      m[m<1&seq(m)%%N<2]=' '
                      write(m,1,N,,"")}


                      Try it online!




                      • -12 bytes thanks to @Giuseppe




                      Previous version with explanation :




                      R, 118 bytes





                      function(s,N=nchar(s)){m=t(replicate(N,el(strsplit(gsub('re',0,s),''))))
                      m[m<1&row(m)%in%c(1,N)]=' '
                      write(m,1,N,,'')}


                      Try it online!




                      • -1 byte thanks to @Giuseppe


                      Unrolled code and explanation :



                      function(s){                       # s is the input string, e.g. 'oreo'

                      N = nchar(s) # store the length of s into N, e.g. 4

                      s1 = gsub('re',0,s) # replace 're' with '0' and store in s1, e.g. 'o0o'

                      v = el(strsplit(s1,'')) # split s1 into a vector v of single characters
                      # e.g. 'o','0','o'

                      m = replicate(N,v) # evaluate N times the vector v and arrange
                      # the result into a matrix m (nchar(s1) x N)
                      # e.g.
                      # 'o' 'o' 'o' 'o'
                      # '0' '0' '0' '0'
                      # 'o' 'o' 'o' 'o'


                      m = t(m) # transpose the matrix

                      m[m<1 & row(m)%in%c(1,N)] = ' ' # substitute the zeros (i.e. where < 1)
                      # on the 1st and last row of the matrix with ' ' (space)
                      # e.g.
                      # 'o' ' ' 'o'
                      # 'o' '0' 'o'
                      # 'o' '0' 'o'
                      # 'o' ' ' 'o'

                      write(m,1,N,,'') # write the matrix to stdout (write function transposes it)
                      # e.g.
                      # oooo
                      # 00
                      # oooo
                      }





                      share|improve this answer


























                      • 106 bytes

                        – Giuseppe
                        Jan 4 at 22:40











                      • aaand 104 bytes returning a list of lines, which isn't acceptable here, but it's an interesting idea (essentially my SNOBOL submission translated to R)

                        – Giuseppe
                        Jan 4 at 23:11
















                      6















                      R, 106 bytes





                      function(s,N=nchar(s)){m=rep(el(strsplit(gsub('re',0,s),'')),e=N)
                      m[m<1&seq(m)%%N<2]=' '
                      write(m,1,N,,"")}


                      Try it online!




                      • -12 bytes thanks to @Giuseppe




                      Previous version with explanation :




                      R, 118 bytes





                      function(s,N=nchar(s)){m=t(replicate(N,el(strsplit(gsub('re',0,s),''))))
                      m[m<1&row(m)%in%c(1,N)]=' '
                      write(m,1,N,,'')}


                      Try it online!




                      • -1 byte thanks to @Giuseppe


                      Unrolled code and explanation :



                      function(s){                       # s is the input string, e.g. 'oreo'

                      N = nchar(s) # store the length of s into N, e.g. 4

                      s1 = gsub('re',0,s) # replace 're' with '0' and store in s1, e.g. 'o0o'

                      v = el(strsplit(s1,'')) # split s1 into a vector v of single characters
                      # e.g. 'o','0','o'

                      m = replicate(N,v) # evaluate N times the vector v and arrange
                      # the result into a matrix m (nchar(s1) x N)
                      # e.g.
                      # 'o' 'o' 'o' 'o'
                      # '0' '0' '0' '0'
                      # 'o' 'o' 'o' 'o'


                      m = t(m) # transpose the matrix

                      m[m<1 & row(m)%in%c(1,N)] = ' ' # substitute the zeros (i.e. where < 1)
                      # on the 1st and last row of the matrix with ' ' (space)
                      # e.g.
                      # 'o' ' ' 'o'
                      # 'o' '0' 'o'
                      # 'o' '0' 'o'
                      # 'o' ' ' 'o'

                      write(m,1,N,,'') # write the matrix to stdout (write function transposes it)
                      # e.g.
                      # oooo
                      # 00
                      # oooo
                      }





                      share|improve this answer


























                      • 106 bytes

                        – Giuseppe
                        Jan 4 at 22:40











                      • aaand 104 bytes returning a list of lines, which isn't acceptable here, but it's an interesting idea (essentially my SNOBOL submission translated to R)

                        – Giuseppe
                        Jan 4 at 23:11














                      6












                      6








                      6








                      R, 106 bytes





                      function(s,N=nchar(s)){m=rep(el(strsplit(gsub('re',0,s),'')),e=N)
                      m[m<1&seq(m)%%N<2]=' '
                      write(m,1,N,,"")}


                      Try it online!




                      • -12 bytes thanks to @Giuseppe




                      Previous version with explanation :




                      R, 118 bytes





                      function(s,N=nchar(s)){m=t(replicate(N,el(strsplit(gsub('re',0,s),''))))
                      m[m<1&row(m)%in%c(1,N)]=' '
                      write(m,1,N,,'')}


                      Try it online!




                      • -1 byte thanks to @Giuseppe


                      Unrolled code and explanation :



                      function(s){                       # s is the input string, e.g. 'oreo'

                      N = nchar(s) # store the length of s into N, e.g. 4

                      s1 = gsub('re',0,s) # replace 're' with '0' and store in s1, e.g. 'o0o'

                      v = el(strsplit(s1,'')) # split s1 into a vector v of single characters
                      # e.g. 'o','0','o'

                      m = replicate(N,v) # evaluate N times the vector v and arrange
                      # the result into a matrix m (nchar(s1) x N)
                      # e.g.
                      # 'o' 'o' 'o' 'o'
                      # '0' '0' '0' '0'
                      # 'o' 'o' 'o' 'o'


                      m = t(m) # transpose the matrix

                      m[m<1 & row(m)%in%c(1,N)] = ' ' # substitute the zeros (i.e. where < 1)
                      # on the 1st and last row of the matrix with ' ' (space)
                      # e.g.
                      # 'o' ' ' 'o'
                      # 'o' '0' 'o'
                      # 'o' '0' 'o'
                      # 'o' ' ' 'o'

                      write(m,1,N,,'') # write the matrix to stdout (write function transposes it)
                      # e.g.
                      # oooo
                      # 00
                      # oooo
                      }





                      share|improve this answer
















                      R, 106 bytes





                      function(s,N=nchar(s)){m=rep(el(strsplit(gsub('re',0,s),'')),e=N)
                      m[m<1&seq(m)%%N<2]=' '
                      write(m,1,N,,"")}


                      Try it online!




                      • -12 bytes thanks to @Giuseppe




                      Previous version with explanation :




                      R, 118 bytes





                      function(s,N=nchar(s)){m=t(replicate(N,el(strsplit(gsub('re',0,s),''))))
                      m[m<1&row(m)%in%c(1,N)]=' '
                      write(m,1,N,,'')}


                      Try it online!




                      • -1 byte thanks to @Giuseppe


                      Unrolled code and explanation :



                      function(s){                       # s is the input string, e.g. 'oreo'

                      N = nchar(s) # store the length of s into N, e.g. 4

                      s1 = gsub('re',0,s) # replace 're' with '0' and store in s1, e.g. 'o0o'

                      v = el(strsplit(s1,'')) # split s1 into a vector v of single characters
                      # e.g. 'o','0','o'

                      m = replicate(N,v) # evaluate N times the vector v and arrange
                      # the result into a matrix m (nchar(s1) x N)
                      # e.g.
                      # 'o' 'o' 'o' 'o'
                      # '0' '0' '0' '0'
                      # 'o' 'o' 'o' 'o'


                      m = t(m) # transpose the matrix

                      m[m<1 & row(m)%in%c(1,N)] = ' ' # substitute the zeros (i.e. where < 1)
                      # on the 1st and last row of the matrix with ' ' (space)
                      # e.g.
                      # 'o' ' ' 'o'
                      # 'o' '0' 'o'
                      # 'o' '0' 'o'
                      # 'o' ' ' 'o'

                      write(m,1,N,,'') # write the matrix to stdout (write function transposes it)
                      # e.g.
                      # oooo
                      # 00
                      # oooo
                      }






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 5 at 7:43

























                      answered Jan 4 at 8:39









                      digEmAlldigEmAll

                      2,664413




                      2,664413













                      • 106 bytes

                        – Giuseppe
                        Jan 4 at 22:40











                      • aaand 104 bytes returning a list of lines, which isn't acceptable here, but it's an interesting idea (essentially my SNOBOL submission translated to R)

                        – Giuseppe
                        Jan 4 at 23:11



















                      • 106 bytes

                        – Giuseppe
                        Jan 4 at 22:40











                      • aaand 104 bytes returning a list of lines, which isn't acceptable here, but it's an interesting idea (essentially my SNOBOL submission translated to R)

                        – Giuseppe
                        Jan 4 at 23:11

















                      106 bytes

                      – Giuseppe
                      Jan 4 at 22:40





                      106 bytes

                      – Giuseppe
                      Jan 4 at 22:40













                      aaand 104 bytes returning a list of lines, which isn't acceptable here, but it's an interesting idea (essentially my SNOBOL submission translated to R)

                      – Giuseppe
                      Jan 4 at 23:11





                      aaand 104 bytes returning a list of lines, which isn't acceptable here, but it's an interesting idea (essentially my SNOBOL submission translated to R)

                      – Giuseppe
                      Jan 4 at 23:11











                      6















                      05AB1E, 18 17 16 bytes



                      'eKεD'rQ2*Igα×}.c


                      -1 byte thanks to @Emigna



                      Uses o for the cookie and r for the filling.



                      Try it online or verify all test cases.



                      Explanation:





                      'eK                 '# Remove all "e" from the (implicit) input
                      # i.e. "orereo" → "orro"
                      ε } # Map all characters to:
                      D # Duplicate the current character
                      'rQ '# Check if it's an "r" (1 if truthy; 0 if falsey)
                      # i.e. "r" → 1
                      # i.e. "o" → 0
                      · # Double that
                      # i.e. 1 → 2
                      # i.e. 0 → 0
                      Ig # Take the length of the input
                      # i.e. "orereo" → 6
                      α # Take the absolute difference between the two
                      # i.e. 2 and 6 → 4
                      # i.e. 0 and 6 → 6
                      × # Repeat the duplicated character that many times
                      # i.e. "r" and 4 → "rrrr"
                      # i.e. "o" and 6 → "oooooo"
                      .c # Then centralize it, which also imlicitly joins by newlines
                      # (and the result is output implicitly)
                      # i.e. ["oooooo","rrrr","rrrr","oooooo"]
                      # → "oooooon rrrrn rrrrnoooooo"





                      share|improve this answer


























                      • Creative solution, But it does not solve the problem entirely: oro would give a wrong answer

                        – Mark Smit
                        Jan 6 at 9:15











                      • @MarkSmit oro isn't a possible input, since the input will only contain os and res. Regardless, oro still seems to output correctly following the spec, since it outputs ooon rnooo. What is wrong about it?

                        – Kevin Cruijssen
                        Jan 6 at 10:44













                      • This is invalid: "The whitespace padding on each side of the filling is required"

                        – NieDzejkob
                        Jan 6 at 15:14











                      • 2* can be · and the missing whitespace can be fixed by changing ».c to .c.B»

                        – Emigna
                        Jan 7 at 9:29











                      • @Emigna Ah, can't believe I haven't thought about ·, thanks! :) And always nice to have changing specs during the challenge, sigh..

                        – Kevin Cruijssen
                        Jan 7 at 9:40


















                      6















                      05AB1E, 18 17 16 bytes



                      'eKεD'rQ2*Igα×}.c


                      -1 byte thanks to @Emigna



                      Uses o for the cookie and r for the filling.



                      Try it online or verify all test cases.



                      Explanation:





                      'eK                 '# Remove all "e" from the (implicit) input
                      # i.e. "orereo" → "orro"
                      ε } # Map all characters to:
                      D # Duplicate the current character
                      'rQ '# Check if it's an "r" (1 if truthy; 0 if falsey)
                      # i.e. "r" → 1
                      # i.e. "o" → 0
                      · # Double that
                      # i.e. 1 → 2
                      # i.e. 0 → 0
                      Ig # Take the length of the input
                      # i.e. "orereo" → 6
                      α # Take the absolute difference between the two
                      # i.e. 2 and 6 → 4
                      # i.e. 0 and 6 → 6
                      × # Repeat the duplicated character that many times
                      # i.e. "r" and 4 → "rrrr"
                      # i.e. "o" and 6 → "oooooo"
                      .c # Then centralize it, which also imlicitly joins by newlines
                      # (and the result is output implicitly)
                      # i.e. ["oooooo","rrrr","rrrr","oooooo"]
                      # → "oooooon rrrrn rrrrnoooooo"





                      share|improve this answer


























                      • Creative solution, But it does not solve the problem entirely: oro would give a wrong answer

                        – Mark Smit
                        Jan 6 at 9:15











                      • @MarkSmit oro isn't a possible input, since the input will only contain os and res. Regardless, oro still seems to output correctly following the spec, since it outputs ooon rnooo. What is wrong about it?

                        – Kevin Cruijssen
                        Jan 6 at 10:44













                      • This is invalid: "The whitespace padding on each side of the filling is required"

                        – NieDzejkob
                        Jan 6 at 15:14











                      • 2* can be · and the missing whitespace can be fixed by changing ».c to .c.B»

                        – Emigna
                        Jan 7 at 9:29











                      • @Emigna Ah, can't believe I haven't thought about ·, thanks! :) And always nice to have changing specs during the challenge, sigh..

                        – Kevin Cruijssen
                        Jan 7 at 9:40
















                      6












                      6








                      6








                      05AB1E, 18 17 16 bytes



                      'eKεD'rQ2*Igα×}.c


                      -1 byte thanks to @Emigna



                      Uses o for the cookie and r for the filling.



                      Try it online or verify all test cases.



                      Explanation:





                      'eK                 '# Remove all "e" from the (implicit) input
                      # i.e. "orereo" → "orro"
                      ε } # Map all characters to:
                      D # Duplicate the current character
                      'rQ '# Check if it's an "r" (1 if truthy; 0 if falsey)
                      # i.e. "r" → 1
                      # i.e. "o" → 0
                      · # Double that
                      # i.e. 1 → 2
                      # i.e. 0 → 0
                      Ig # Take the length of the input
                      # i.e. "orereo" → 6
                      α # Take the absolute difference between the two
                      # i.e. 2 and 6 → 4
                      # i.e. 0 and 6 → 6
                      × # Repeat the duplicated character that many times
                      # i.e. "r" and 4 → "rrrr"
                      # i.e. "o" and 6 → "oooooo"
                      .c # Then centralize it, which also imlicitly joins by newlines
                      # (and the result is output implicitly)
                      # i.e. ["oooooo","rrrr","rrrr","oooooo"]
                      # → "oooooon rrrrn rrrrnoooooo"





                      share|improve this answer
















                      05AB1E, 18 17 16 bytes



                      'eKεD'rQ2*Igα×}.c


                      -1 byte thanks to @Emigna



                      Uses o for the cookie and r for the filling.



                      Try it online or verify all test cases.



                      Explanation:





                      'eK                 '# Remove all "e" from the (implicit) input
                      # i.e. "orereo" → "orro"
                      ε } # Map all characters to:
                      D # Duplicate the current character
                      'rQ '# Check if it's an "r" (1 if truthy; 0 if falsey)
                      # i.e. "r" → 1
                      # i.e. "o" → 0
                      · # Double that
                      # i.e. 1 → 2
                      # i.e. 0 → 0
                      Ig # Take the length of the input
                      # i.e. "orereo" → 6
                      α # Take the absolute difference between the two
                      # i.e. 2 and 6 → 4
                      # i.e. 0 and 6 → 6
                      × # Repeat the duplicated character that many times
                      # i.e. "r" and 4 → "rrrr"
                      # i.e. "o" and 6 → "oooooo"
                      .c # Then centralize it, which also imlicitly joins by newlines
                      # (and the result is output implicitly)
                      # i.e. ["oooooo","rrrr","rrrr","oooooo"]
                      # → "oooooon rrrrn rrrrnoooooo"






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 8 at 7:45

























                      answered Jan 4 at 7:28









                      Kevin CruijssenKevin Cruijssen

                      36.2k554190




                      36.2k554190













                      • Creative solution, But it does not solve the problem entirely: oro would give a wrong answer

                        – Mark Smit
                        Jan 6 at 9:15











                      • @MarkSmit oro isn't a possible input, since the input will only contain os and res. Regardless, oro still seems to output correctly following the spec, since it outputs ooon rnooo. What is wrong about it?

                        – Kevin Cruijssen
                        Jan 6 at 10:44













                      • This is invalid: "The whitespace padding on each side of the filling is required"

                        – NieDzejkob
                        Jan 6 at 15:14











                      • 2* can be · and the missing whitespace can be fixed by changing ».c to .c.B»

                        – Emigna
                        Jan 7 at 9:29











                      • @Emigna Ah, can't believe I haven't thought about ·, thanks! :) And always nice to have changing specs during the challenge, sigh..

                        – Kevin Cruijssen
                        Jan 7 at 9:40





















                      • Creative solution, But it does not solve the problem entirely: oro would give a wrong answer

                        – Mark Smit
                        Jan 6 at 9:15











                      • @MarkSmit oro isn't a possible input, since the input will only contain os and res. Regardless, oro still seems to output correctly following the spec, since it outputs ooon rnooo. What is wrong about it?

                        – Kevin Cruijssen
                        Jan 6 at 10:44













                      • This is invalid: "The whitespace padding on each side of the filling is required"

                        – NieDzejkob
                        Jan 6 at 15:14











                      • 2* can be · and the missing whitespace can be fixed by changing ».c to .c.B»

                        – Emigna
                        Jan 7 at 9:29











                      • @Emigna Ah, can't believe I haven't thought about ·, thanks! :) And always nice to have changing specs during the challenge, sigh..

                        – Kevin Cruijssen
                        Jan 7 at 9:40



















                      Creative solution, But it does not solve the problem entirely: oro would give a wrong answer

                      – Mark Smit
                      Jan 6 at 9:15





                      Creative solution, But it does not solve the problem entirely: oro would give a wrong answer

                      – Mark Smit
                      Jan 6 at 9:15













                      @MarkSmit oro isn't a possible input, since the input will only contain os and res. Regardless, oro still seems to output correctly following the spec, since it outputs ooon rnooo. What is wrong about it?

                      – Kevin Cruijssen
                      Jan 6 at 10:44







                      @MarkSmit oro isn't a possible input, since the input will only contain os and res. Regardless, oro still seems to output correctly following the spec, since it outputs ooon rnooo. What is wrong about it?

                      – Kevin Cruijssen
                      Jan 6 at 10:44















                      This is invalid: "The whitespace padding on each side of the filling is required"

                      – NieDzejkob
                      Jan 6 at 15:14





                      This is invalid: "The whitespace padding on each side of the filling is required"

                      – NieDzejkob
                      Jan 6 at 15:14













                      2* can be · and the missing whitespace can be fixed by changing ».c to .c.B»

                      – Emigna
                      Jan 7 at 9:29





                      2* can be · and the missing whitespace can be fixed by changing ».c to .c.B»

                      – Emigna
                      Jan 7 at 9:29













                      @Emigna Ah, can't believe I haven't thought about ·, thanks! :) And always nice to have changing specs during the challenge, sigh..

                      – Kevin Cruijssen
                      Jan 7 at 9:40







                      @Emigna Ah, can't believe I haven't thought about ·, thanks! :) And always nice to have changing specs during the challenge, sigh..

                      – Kevin Cruijssen
                      Jan 7 at 9:40













                      5















                      Retina, 74 73 bytes



                      I feel like I haven't posted an answer in a very long time. Well, here I am. Also, Retina has changed a lot, and I feel like I suck at it now.



                      .+
                      $0$.0
                      (d+)
                      *
                      e

                      o|r
                      $&¶
                      _$

                      +(/_/&`o¶
                      oo¶
                      _$

                      )/_/&`r¶
                      rr¶
                      ¶$

                      m`^r



                      Try it online!






                      share|improve this answer





















                      • 1





                        Whoa, what a crazy looking language. I like it!

                        – GammaGames
                        Jan 4 at 1:58











                      • doesn't include trailing whitespaces..

                        – dzaima
                        Jan 4 at 2:00






                      • 2





                        I like how [or] means o or r instead of [ or ]. Makes my head hurt.

                        – nedla2004
                        Jan 4 at 2:43











                      • @dzaima The question does not specify that trailing whitespaces are required. A comment asked, but no reply was given.

                        – mbomb007
                        Jan 4 at 19:44











                      • @nedla2004 That actually helped me notice a way to save a byte. Thanks.

                        – mbomb007
                        Jan 4 at 19:44
















                      5















                      Retina, 74 73 bytes



                      I feel like I haven't posted an answer in a very long time. Well, here I am. Also, Retina has changed a lot, and I feel like I suck at it now.



                      .+
                      $0$.0
                      (d+)
                      *
                      e

                      o|r
                      $&¶
                      _$

                      +(/_/&`o¶
                      oo¶
                      _$

                      )/_/&`r¶
                      rr¶
                      ¶$

                      m`^r



                      Try it online!






                      share|improve this answer





















                      • 1





                        Whoa, what a crazy looking language. I like it!

                        – GammaGames
                        Jan 4 at 1:58











                      • doesn't include trailing whitespaces..

                        – dzaima
                        Jan 4 at 2:00






                      • 2





                        I like how [or] means o or r instead of [ or ]. Makes my head hurt.

                        – nedla2004
                        Jan 4 at 2:43











                      • @dzaima The question does not specify that trailing whitespaces are required. A comment asked, but no reply was given.

                        – mbomb007
                        Jan 4 at 19:44











                      • @nedla2004 That actually helped me notice a way to save a byte. Thanks.

                        – mbomb007
                        Jan 4 at 19:44














                      5












                      5








                      5








                      Retina, 74 73 bytes



                      I feel like I haven't posted an answer in a very long time. Well, here I am. Also, Retina has changed a lot, and I feel like I suck at it now.



                      .+
                      $0$.0
                      (d+)
                      *
                      e

                      o|r
                      $&¶
                      _$

                      +(/_/&`o¶
                      oo¶
                      _$

                      )/_/&`r¶
                      rr¶
                      ¶$

                      m`^r



                      Try it online!






                      share|improve this answer
















                      Retina, 74 73 bytes



                      I feel like I haven't posted an answer in a very long time. Well, here I am. Also, Retina has changed a lot, and I feel like I suck at it now.



                      .+
                      $0$.0
                      (d+)
                      *
                      e

                      o|r
                      $&¶
                      _$

                      +(/_/&`o¶
                      oo¶
                      _$

                      )/_/&`r¶
                      rr¶
                      ¶$

                      m`^r



                      Try it online!







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 4 at 19:45

























                      answered Jan 4 at 1:55









                      mbomb007mbomb007

                      17.6k542118




                      17.6k542118








                      • 1





                        Whoa, what a crazy looking language. I like it!

                        – GammaGames
                        Jan 4 at 1:58











                      • doesn't include trailing whitespaces..

                        – dzaima
                        Jan 4 at 2:00






                      • 2





                        I like how [or] means o or r instead of [ or ]. Makes my head hurt.

                        – nedla2004
                        Jan 4 at 2:43











                      • @dzaima The question does not specify that trailing whitespaces are required. A comment asked, but no reply was given.

                        – mbomb007
                        Jan 4 at 19:44











                      • @nedla2004 That actually helped me notice a way to save a byte. Thanks.

                        – mbomb007
                        Jan 4 at 19:44














                      • 1





                        Whoa, what a crazy looking language. I like it!

                        – GammaGames
                        Jan 4 at 1:58











                      • doesn't include trailing whitespaces..

                        – dzaima
                        Jan 4 at 2:00






                      • 2





                        I like how [or] means o or r instead of [ or ]. Makes my head hurt.

                        – nedla2004
                        Jan 4 at 2:43











                      • @dzaima The question does not specify that trailing whitespaces are required. A comment asked, but no reply was given.

                        – mbomb007
                        Jan 4 at 19:44











                      • @nedla2004 That actually helped me notice a way to save a byte. Thanks.

                        – mbomb007
                        Jan 4 at 19:44








                      1




                      1





                      Whoa, what a crazy looking language. I like it!

                      – GammaGames
                      Jan 4 at 1:58





                      Whoa, what a crazy looking language. I like it!

                      – GammaGames
                      Jan 4 at 1:58













                      doesn't include trailing whitespaces..

                      – dzaima
                      Jan 4 at 2:00





                      doesn't include trailing whitespaces..

                      – dzaima
                      Jan 4 at 2:00




                      2




                      2





                      I like how [or] means o or r instead of [ or ]. Makes my head hurt.

                      – nedla2004
                      Jan 4 at 2:43





                      I like how [or] means o or r instead of [ or ]. Makes my head hurt.

                      – nedla2004
                      Jan 4 at 2:43













                      @dzaima The question does not specify that trailing whitespaces are required. A comment asked, but no reply was given.

                      – mbomb007
                      Jan 4 at 19:44





                      @dzaima The question does not specify that trailing whitespaces are required. A comment asked, but no reply was given.

                      – mbomb007
                      Jan 4 at 19:44













                      @nedla2004 That actually helped me notice a way to save a byte. Thanks.

                      – mbomb007
                      Jan 4 at 19:44





                      @nedla2004 That actually helped me notice a way to save a byte. Thanks.

                      – mbomb007
                      Jan 4 at 19:44











                      5















                      Retina, 21 bytes



                      r

                      L$`.
                      $.+*$&
                      bee



                      Try it online! Explanation:



                      r



                      Delete the rs.



                      L$`.
                      $.+*$&


                      List each letter on its own line repeated to the length of the original input.



                      bee



                      Replace the first two ees on each line with a space.






                      share|improve this answer


























                      • This breaks the rules: "The whitespace padding on each side of the filling is required"

                        – NieDzejkob
                        Jan 6 at 15:16











                      • @NieDzejkob Sorry for overlooking that, should be fixed now.

                        – Neil
                        Jan 6 at 16:14











                      • FYI trailing whitespace requirement lifted.

                        – P1h3r1e3d13
                        Jan 8 at 0:26











                      • @Neil You should fix that &amp; :P

                        – ASCII-only
                        Jan 8 at 0:35
















                      5















                      Retina, 21 bytes



                      r

                      L$`.
                      $.+*$&
                      bee



                      Try it online! Explanation:



                      r



                      Delete the rs.



                      L$`.
                      $.+*$&


                      List each letter on its own line repeated to the length of the original input.



                      bee



                      Replace the first two ees on each line with a space.






                      share|improve this answer


























                      • This breaks the rules: "The whitespace padding on each side of the filling is required"

                        – NieDzejkob
                        Jan 6 at 15:16











                      • @NieDzejkob Sorry for overlooking that, should be fixed now.

                        – Neil
                        Jan 6 at 16:14











                      • FYI trailing whitespace requirement lifted.

                        – P1h3r1e3d13
                        Jan 8 at 0:26











                      • @Neil You should fix that &amp; :P

                        – ASCII-only
                        Jan 8 at 0:35














                      5












                      5








                      5








                      Retina, 21 bytes



                      r

                      L$`.
                      $.+*$&
                      bee



                      Try it online! Explanation:



                      r



                      Delete the rs.



                      L$`.
                      $.+*$&


                      List each letter on its own line repeated to the length of the original input.



                      bee



                      Replace the first two ees on each line with a space.






                      share|improve this answer
















                      Retina, 21 bytes



                      r

                      L$`.
                      $.+*$&
                      bee



                      Try it online! Explanation:



                      r



                      Delete the rs.



                      L$`.
                      $.+*$&


                      List each letter on its own line repeated to the length of the original input.



                      bee



                      Replace the first two ees on each line with a space.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 8 at 2:15

























                      answered Jan 4 at 13:04









                      NeilNeil

                      79.7k744177




                      79.7k744177













                      • This breaks the rules: "The whitespace padding on each side of the filling is required"

                        – NieDzejkob
                        Jan 6 at 15:16











                      • @NieDzejkob Sorry for overlooking that, should be fixed now.

                        – Neil
                        Jan 6 at 16:14











                      • FYI trailing whitespace requirement lifted.

                        – P1h3r1e3d13
                        Jan 8 at 0:26











                      • @Neil You should fix that &amp; :P

                        – ASCII-only
                        Jan 8 at 0:35



















                      • This breaks the rules: "The whitespace padding on each side of the filling is required"

                        – NieDzejkob
                        Jan 6 at 15:16











                      • @NieDzejkob Sorry for overlooking that, should be fixed now.

                        – Neil
                        Jan 6 at 16:14











                      • FYI trailing whitespace requirement lifted.

                        – P1h3r1e3d13
                        Jan 8 at 0:26











                      • @Neil You should fix that &amp; :P

                        – ASCII-only
                        Jan 8 at 0:35

















                      This breaks the rules: "The whitespace padding on each side of the filling is required"

                      – NieDzejkob
                      Jan 6 at 15:16





                      This breaks the rules: "The whitespace padding on each side of the filling is required"

                      – NieDzejkob
                      Jan 6 at 15:16













                      @NieDzejkob Sorry for overlooking that, should be fixed now.

                      – Neil
                      Jan 6 at 16:14





                      @NieDzejkob Sorry for overlooking that, should be fixed now.

                      – Neil
                      Jan 6 at 16:14













                      FYI trailing whitespace requirement lifted.

                      – P1h3r1e3d13
                      Jan 8 at 0:26





                      FYI trailing whitespace requirement lifted.

                      – P1h3r1e3d13
                      Jan 8 at 0:26













                      @Neil You should fix that &amp; :P

                      – ASCII-only
                      Jan 8 at 0:35





                      @Neil You should fix that &amp; :P

                      – ASCII-only
                      Jan 8 at 0:35











                      4














                      JavaScript ES6, 103 bytes



                      Using replace 103 bytes:





                      x=>x.replace(/o/g,"-".repeat(s=x.length)+`
                      `).replace(/re/g," "+"|".repeat(s>1?s-2:0)+`
                      `).slice(0,-1)


                      Try it online!



                      Using split and map 116 bytes:





                      x=>x.split("re").map(y=>("-"[h='repeat'](r=x.length)+`
                      `)[h](y.length)).join(" "+"|"[h](r>1?r-2:0)+`
                      `).slice(0,-1)


                      Try it online!






                      share|improve this answer





















                      • 1





                        JS, nice! You reminded me that I was going to add a rule about not having line returns at the end of the output, I've added it. Sorry about that!

                        – GammaGames
                        Jan 4 at 1:45






                      • 3





                        just removing the final newline is 12 bytes

                        – fəˈnɛtɪk
                        Jan 4 at 1:51











                      • There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                        – GammaGames
                        Jan 4 at 4:44






                      • 3





                        You can save a byte by using a template string with ${"|".repeat(s>1?s-2:0)} and its whitespaces, instead of using " "+"|".repeat(s>1?s-2:0).

                        – Ismael Miguel
                        Jan 4 at 10:26













                      • If you use backticks for the string in the first split, you can remove the parentheses around it.

                        – skiilaa
                        9 hours ago
















                      4














                      JavaScript ES6, 103 bytes



                      Using replace 103 bytes:





                      x=>x.replace(/o/g,"-".repeat(s=x.length)+`
                      `).replace(/re/g," "+"|".repeat(s>1?s-2:0)+`
                      `).slice(0,-1)


                      Try it online!



                      Using split and map 116 bytes:





                      x=>x.split("re").map(y=>("-"[h='repeat'](r=x.length)+`
                      `)[h](y.length)).join(" "+"|"[h](r>1?r-2:0)+`
                      `).slice(0,-1)


                      Try it online!






                      share|improve this answer





















                      • 1





                        JS, nice! You reminded me that I was going to add a rule about not having line returns at the end of the output, I've added it. Sorry about that!

                        – GammaGames
                        Jan 4 at 1:45






                      • 3





                        just removing the final newline is 12 bytes

                        – fəˈnɛtɪk
                        Jan 4 at 1:51











                      • There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                        – GammaGames
                        Jan 4 at 4:44






                      • 3





                        You can save a byte by using a template string with ${"|".repeat(s>1?s-2:0)} and its whitespaces, instead of using " "+"|".repeat(s>1?s-2:0).

                        – Ismael Miguel
                        Jan 4 at 10:26













                      • If you use backticks for the string in the first split, you can remove the parentheses around it.

                        – skiilaa
                        9 hours ago














                      4












                      4








                      4







                      JavaScript ES6, 103 bytes



                      Using replace 103 bytes:





                      x=>x.replace(/o/g,"-".repeat(s=x.length)+`
                      `).replace(/re/g," "+"|".repeat(s>1?s-2:0)+`
                      `).slice(0,-1)


                      Try it online!



                      Using split and map 116 bytes:





                      x=>x.split("re").map(y=>("-"[h='repeat'](r=x.length)+`
                      `)[h](y.length)).join(" "+"|"[h](r>1?r-2:0)+`
                      `).slice(0,-1)


                      Try it online!






                      share|improve this answer















                      JavaScript ES6, 103 bytes



                      Using replace 103 bytes:





                      x=>x.replace(/o/g,"-".repeat(s=x.length)+`
                      `).replace(/re/g," "+"|".repeat(s>1?s-2:0)+`
                      `).slice(0,-1)


                      Try it online!



                      Using split and map 116 bytes:





                      x=>x.split("re").map(y=>("-"[h='repeat'](r=x.length)+`
                      `)[h](y.length)).join(" "+"|"[h](r>1?r-2:0)+`
                      `).slice(0,-1)


                      Try it online!







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 4 at 1:55

























                      answered Jan 4 at 1:40









                      fəˈnɛtɪkfəˈnɛtɪk

                      3,6131537




                      3,6131537








                      • 1





                        JS, nice! You reminded me that I was going to add a rule about not having line returns at the end of the output, I've added it. Sorry about that!

                        – GammaGames
                        Jan 4 at 1:45






                      • 3





                        just removing the final newline is 12 bytes

                        – fəˈnɛtɪk
                        Jan 4 at 1:51











                      • There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                        – GammaGames
                        Jan 4 at 4:44






                      • 3





                        You can save a byte by using a template string with ${"|".repeat(s>1?s-2:0)} and its whitespaces, instead of using " "+"|".repeat(s>1?s-2:0).

                        – Ismael Miguel
                        Jan 4 at 10:26













                      • If you use backticks for the string in the first split, you can remove the parentheses around it.

                        – skiilaa
                        9 hours ago














                      • 1





                        JS, nice! You reminded me that I was going to add a rule about not having line returns at the end of the output, I've added it. Sorry about that!

                        – GammaGames
                        Jan 4 at 1:45






                      • 3





                        just removing the final newline is 12 bytes

                        – fəˈnɛtɪk
                        Jan 4 at 1:51











                      • There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                        – GammaGames
                        Jan 4 at 4:44






                      • 3





                        You can save a byte by using a template string with ${"|".repeat(s>1?s-2:0)} and its whitespaces, instead of using " "+"|".repeat(s>1?s-2:0).

                        – Ismael Miguel
                        Jan 4 at 10:26













                      • If you use backticks for the string in the first split, you can remove the parentheses around it.

                        – skiilaa
                        9 hours ago








                      1




                      1





                      JS, nice! You reminded me that I was going to add a rule about not having line returns at the end of the output, I've added it. Sorry about that!

                      – GammaGames
                      Jan 4 at 1:45





                      JS, nice! You reminded me that I was going to add a rule about not having line returns at the end of the output, I've added it. Sorry about that!

                      – GammaGames
                      Jan 4 at 1:45




                      3




                      3





                      just removing the final newline is 12 bytes

                      – fəˈnɛtɪk
                      Jan 4 at 1:51





                      just removing the final newline is 12 bytes

                      – fəˈnɛtɪk
                      Jan 4 at 1:51













                      There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                      – GammaGames
                      Jan 4 at 4:44





                      There was enough feedback that I removed the trailing newline rule. Feel free to update your entry.

                      – GammaGames
                      Jan 4 at 4:44




                      3




                      3





                      You can save a byte by using a template string with ${"|".repeat(s>1?s-2:0)} and its whitespaces, instead of using " "+"|".repeat(s>1?s-2:0).

                      – Ismael Miguel
                      Jan 4 at 10:26







                      You can save a byte by using a template string with ${"|".repeat(s>1?s-2:0)} and its whitespaces, instead of using " "+"|".repeat(s>1?s-2:0).

                      – Ismael Miguel
                      Jan 4 at 10:26















                      If you use backticks for the string in the first split, you can remove the parentheses around it.

                      – skiilaa
                      9 hours ago





                      If you use backticks for the string in the first split, you can remove the parentheses around it.

                      – skiilaa
                      9 hours ago











                      4















                      Python 3, 77 bytes





                      lambda x:x.replace("o","-"*len(x)+"n").replace("re"," "+'.'*(len(x)-2)+"n")


                      Try it online!






                      share|improve this answer


























                      • Clever! I did intend the output to not be printing whitespace for the filling (it's pretty much oreo ascii), so I have edited the rules accordingly. Sorry about that! And I always love a python answer :)

                        – GammaGames
                        Jan 4 at 4:50













                      • @JonathanFrech migth as well delete the comments, that approach was invalidated. I'll work on golfing more tomorrow.

                        – Riker
                        Jan 4 at 4:55











                      • You can remove the space at +" n" to save a byte.

                        – Kevin Cruijssen
                        Jan 4 at 10:37











                      • @KevinCruijssen can I? The input program says the whole cookie must be as wide as the input.

                        – Riker
                        Jan 4 at 16:18






                      • 2





                        I interpreted that as meaning that a trailing space is the same (visually) as no space. That's the beauty of answers to ascii art challenges. If they look right they are right :-)

                        – ElPedro
                        Jan 4 at 21:33


















                      4















                      Python 3, 77 bytes





                      lambda x:x.replace("o","-"*len(x)+"n").replace("re"," "+'.'*(len(x)-2)+"n")


                      Try it online!






                      share|improve this answer


























                      • Clever! I did intend the output to not be printing whitespace for the filling (it's pretty much oreo ascii), so I have edited the rules accordingly. Sorry about that! And I always love a python answer :)

                        – GammaGames
                        Jan 4 at 4:50













                      • @JonathanFrech migth as well delete the comments, that approach was invalidated. I'll work on golfing more tomorrow.

                        – Riker
                        Jan 4 at 4:55











                      • You can remove the space at +" n" to save a byte.

                        – Kevin Cruijssen
                        Jan 4 at 10:37











                      • @KevinCruijssen can I? The input program says the whole cookie must be as wide as the input.

                        – Riker
                        Jan 4 at 16:18






                      • 2





                        I interpreted that as meaning that a trailing space is the same (visually) as no space. That's the beauty of answers to ascii art challenges. If they look right they are right :-)

                        – ElPedro
                        Jan 4 at 21:33
















                      4












                      4








                      4








                      Python 3, 77 bytes





                      lambda x:x.replace("o","-"*len(x)+"n").replace("re"," "+'.'*(len(x)-2)+"n")


                      Try it online!






                      share|improve this answer
















                      Python 3, 77 bytes





                      lambda x:x.replace("o","-"*len(x)+"n").replace("re"," "+'.'*(len(x)-2)+"n")


                      Try it online!







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 4 at 21:37

























                      answered Jan 4 at 4:13









                      RikerRiker

                      5,98042767




                      5,98042767













                      • Clever! I did intend the output to not be printing whitespace for the filling (it's pretty much oreo ascii), so I have edited the rules accordingly. Sorry about that! And I always love a python answer :)

                        – GammaGames
                        Jan 4 at 4:50













                      • @JonathanFrech migth as well delete the comments, that approach was invalidated. I'll work on golfing more tomorrow.

                        – Riker
                        Jan 4 at 4:55











                      • You can remove the space at +" n" to save a byte.

                        – Kevin Cruijssen
                        Jan 4 at 10:37











                      • @KevinCruijssen can I? The input program says the whole cookie must be as wide as the input.

                        – Riker
                        Jan 4 at 16:18






                      • 2





                        I interpreted that as meaning that a trailing space is the same (visually) as no space. That's the beauty of answers to ascii art challenges. If they look right they are right :-)

                        – ElPedro
                        Jan 4 at 21:33





















                      • Clever! I did intend the output to not be printing whitespace for the filling (it's pretty much oreo ascii), so I have edited the rules accordingly. Sorry about that! And I always love a python answer :)

                        – GammaGames
                        Jan 4 at 4:50













                      • @JonathanFrech migth as well delete the comments, that approach was invalidated. I'll work on golfing more tomorrow.

                        – Riker
                        Jan 4 at 4:55











                      • You can remove the space at +" n" to save a byte.

                        – Kevin Cruijssen
                        Jan 4 at 10:37











                      • @KevinCruijssen can I? The input program says the whole cookie must be as wide as the input.

                        – Riker
                        Jan 4 at 16:18






                      • 2





                        I interpreted that as meaning that a trailing space is the same (visually) as no space. That's the beauty of answers to ascii art challenges. If they look right they are right :-)

                        – ElPedro
                        Jan 4 at 21:33



















                      Clever! I did intend the output to not be printing whitespace for the filling (it's pretty much oreo ascii), so I have edited the rules accordingly. Sorry about that! And I always love a python answer :)

                      – GammaGames
                      Jan 4 at 4:50







                      Clever! I did intend the output to not be printing whitespace for the filling (it's pretty much oreo ascii), so I have edited the rules accordingly. Sorry about that! And I always love a python answer :)

                      – GammaGames
                      Jan 4 at 4:50















                      @JonathanFrech migth as well delete the comments, that approach was invalidated. I'll work on golfing more tomorrow.

                      – Riker
                      Jan 4 at 4:55





                      @JonathanFrech migth as well delete the comments, that approach was invalidated. I'll work on golfing more tomorrow.

                      – Riker
                      Jan 4 at 4:55













                      You can remove the space at +" n" to save a byte.

                      – Kevin Cruijssen
                      Jan 4 at 10:37





                      You can remove the space at +" n" to save a byte.

                      – Kevin Cruijssen
                      Jan 4 at 10:37













                      @KevinCruijssen can I? The input program says the whole cookie must be as wide as the input.

                      – Riker
                      Jan 4 at 16:18





                      @KevinCruijssen can I? The input program says the whole cookie must be as wide as the input.

                      – Riker
                      Jan 4 at 16:18




                      2




                      2





                      I interpreted that as meaning that a trailing space is the same (visually) as no space. That's the beauty of answers to ascii art challenges. If they look right they are right :-)

                      – ElPedro
                      Jan 4 at 21:33







                      I interpreted that as meaning that a trailing space is the same (visually) as no space. That's the beauty of answers to ascii art challenges. If they look right they are right :-)

                      – ElPedro
                      Jan 4 at 21:33













                      4














                      Powershell, 71 69 bytes



                      -2 bytes thanks @Veskah





                      $l=$args|% le*
                      switch($args|% t*y){'o'{'#'*$l}'r'{" $('%'*($l-2)) "}}


                      Less golfed test script:



                      $f = {

                      $l=$args|% length
                      switch($args|% t*y){
                      'o'{'#'*$l}
                      'r'{" $('%'*($l-2)) "}
                      }

                      }

                      @(

                      ,(
                      'oreo',
                      '####',
                      ' %% ',
                      '####'
                      )
                      ,(
                      'o',
                      '#'
                      )
                      ,(
                      're',
                      ' '
                      )
                      ,(
                      'rere',
                      ' %% ',
                      ' %% '
                      )
                      ,(
                      'oreoorererereoo',
                      '###############',
                      ' %%%%%%%%%%%%% ',
                      '###############',
                      '###############',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      '###############',
                      '###############'
                      )

                      ) | % {
                      $s,$expected = $_
                      $result = &$f $s
                      "$result"-eq"$expected"
                      # $result # uncomment this line to display a result
                      }


                      Output:



                      True
                      True
                      True
                      True
                      True





                      share|improve this answer





















                      • 1





                        Looks like you don't need parens around the $args 69 bytes

                        – Veskah
                        Jan 4 at 23:30






                      • 1





                        The length of [string] is an [int]... The [int] is [int] if the array contains one element only. Great! Thanks!

                        – mazzy
                        Jan 5 at 8:55


















                      4














                      Powershell, 71 69 bytes



                      -2 bytes thanks @Veskah





                      $l=$args|% le*
                      switch($args|% t*y){'o'{'#'*$l}'r'{" $('%'*($l-2)) "}}


                      Less golfed test script:



                      $f = {

                      $l=$args|% length
                      switch($args|% t*y){
                      'o'{'#'*$l}
                      'r'{" $('%'*($l-2)) "}
                      }

                      }

                      @(

                      ,(
                      'oreo',
                      '####',
                      ' %% ',
                      '####'
                      )
                      ,(
                      'o',
                      '#'
                      )
                      ,(
                      're',
                      ' '
                      )
                      ,(
                      'rere',
                      ' %% ',
                      ' %% '
                      )
                      ,(
                      'oreoorererereoo',
                      '###############',
                      ' %%%%%%%%%%%%% ',
                      '###############',
                      '###############',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      '###############',
                      '###############'
                      )

                      ) | % {
                      $s,$expected = $_
                      $result = &$f $s
                      "$result"-eq"$expected"
                      # $result # uncomment this line to display a result
                      }


                      Output:



                      True
                      True
                      True
                      True
                      True





                      share|improve this answer





















                      • 1





                        Looks like you don't need parens around the $args 69 bytes

                        – Veskah
                        Jan 4 at 23:30






                      • 1





                        The length of [string] is an [int]... The [int] is [int] if the array contains one element only. Great! Thanks!

                        – mazzy
                        Jan 5 at 8:55
















                      4












                      4








                      4







                      Powershell, 71 69 bytes



                      -2 bytes thanks @Veskah





                      $l=$args|% le*
                      switch($args|% t*y){'o'{'#'*$l}'r'{" $('%'*($l-2)) "}}


                      Less golfed test script:



                      $f = {

                      $l=$args|% length
                      switch($args|% t*y){
                      'o'{'#'*$l}
                      'r'{" $('%'*($l-2)) "}
                      }

                      }

                      @(

                      ,(
                      'oreo',
                      '####',
                      ' %% ',
                      '####'
                      )
                      ,(
                      'o',
                      '#'
                      )
                      ,(
                      're',
                      ' '
                      )
                      ,(
                      'rere',
                      ' %% ',
                      ' %% '
                      )
                      ,(
                      'oreoorererereoo',
                      '###############',
                      ' %%%%%%%%%%%%% ',
                      '###############',
                      '###############',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      '###############',
                      '###############'
                      )

                      ) | % {
                      $s,$expected = $_
                      $result = &$f $s
                      "$result"-eq"$expected"
                      # $result # uncomment this line to display a result
                      }


                      Output:



                      True
                      True
                      True
                      True
                      True





                      share|improve this answer















                      Powershell, 71 69 bytes



                      -2 bytes thanks @Veskah





                      $l=$args|% le*
                      switch($args|% t*y){'o'{'#'*$l}'r'{" $('%'*($l-2)) "}}


                      Less golfed test script:



                      $f = {

                      $l=$args|% length
                      switch($args|% t*y){
                      'o'{'#'*$l}
                      'r'{" $('%'*($l-2)) "}
                      }

                      }

                      @(

                      ,(
                      'oreo',
                      '####',
                      ' %% ',
                      '####'
                      )
                      ,(
                      'o',
                      '#'
                      )
                      ,(
                      're',
                      ' '
                      )
                      ,(
                      'rere',
                      ' %% ',
                      ' %% '
                      )
                      ,(
                      'oreoorererereoo',
                      '###############',
                      ' %%%%%%%%%%%%% ',
                      '###############',
                      '###############',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      ' %%%%%%%%%%%%% ',
                      '###############',
                      '###############'
                      )

                      ) | % {
                      $s,$expected = $_
                      $result = &$f $s
                      "$result"-eq"$expected"
                      # $result # uncomment this line to display a result
                      }


                      Output:



                      True
                      True
                      True
                      True
                      True






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 5 at 8:56

























                      answered Jan 4 at 15:37









                      mazzymazzy

                      2,2451315




                      2,2451315








                      • 1





                        Looks like you don't need parens around the $args 69 bytes

                        – Veskah
                        Jan 4 at 23:30






                      • 1





                        The length of [string] is an [int]... The [int] is [int] if the array contains one element only. Great! Thanks!

                        – mazzy
                        Jan 5 at 8:55
















                      • 1





                        Looks like you don't need parens around the $args 69 bytes

                        – Veskah
                        Jan 4 at 23:30






                      • 1





                        The length of [string] is an [int]... The [int] is [int] if the array contains one element only. Great! Thanks!

                        – mazzy
                        Jan 5 at 8:55










                      1




                      1





                      Looks like you don't need parens around the $args 69 bytes

                      – Veskah
                      Jan 4 at 23:30





                      Looks like you don't need parens around the $args 69 bytes

                      – Veskah
                      Jan 4 at 23:30




                      1




                      1





                      The length of [string] is an [int]... The [int] is [int] if the array contains one element only. Great! Thanks!

                      – mazzy
                      Jan 5 at 8:55







                      The length of [string] is an [int]... The [int] is [int] if the array contains one element only. Great! Thanks!

                      – mazzy
                      Jan 5 at 8:55













                      4














                      Mathematica, 111 91 bytes



                      #~StringReplace~{"o"->"O"~Table~(n=StringLength@#)<>"n","re"->" "<>Table["R",n-2]<>" n"}&


                      Try It Online!



                      This was majorly shortened thanks to Misha's edits.





                      My original code:



                      (z=StringRepeat;n=StringLength@#;#~StringReplace~{"o"->"O"~z~n<>"n","re"->" "<>If[n>2,z["R",n-2],""]<>" n"})&


                      This code is not very fancy but it seems too expensive to convert away from strings and then back or to do anything else clever.



                      In particular, with only 3-4 commands that have the name String, my original approach couldn't save bytes at all by trying to abstract that away. For example, the following is 129 bytes:



                      (w=Symbol["String"<>#]&;z=w@"Repeat";n=w["Length"]@#;#~w@"Replace"~{"o"->"O"~z~n<>"n","re"->" "<>If[n>2,z["R",n-2],""]<>" n"})&





                      share|improve this answer





















                      • 1





                        A few improvements: StringRepeat can be Table since <> will convert the list into a string later; the If is unnecessary since we take the re branch only when n is at least 2; we can save on parentheses by defining n only when we use it. Try it online!

                        – Misha Lavrov
                        Jan 5 at 20:32











                      • @MishaLavrov The If was added because StringRepeat would throw an error on the case of "re"; it doesn't allow you to repeat a string 0 times. Table has no such limitation, so that's a big save!

                        – Mark S.
                        Jan 5 at 21:33
















                      4














                      Mathematica, 111 91 bytes



                      #~StringReplace~{"o"->"O"~Table~(n=StringLength@#)<>"n","re"->" "<>Table["R",n-2]<>" n"}&


                      Try It Online!



                      This was majorly shortened thanks to Misha's edits.





                      My original code:



                      (z=StringRepeat;n=StringLength@#;#~StringReplace~{"o"->"O"~z~n<>"n","re"->" "<>If[n>2,z["R",n-2],""]<>" n"})&


                      This code is not very fancy but it seems too expensive to convert away from strings and then back or to do anything else clever.



                      In particular, with only 3-4 commands that have the name String, my original approach couldn't save bytes at all by trying to abstract that away. For example, the following is 129 bytes:



                      (w=Symbol["String"<>#]&;z=w@"Repeat";n=w["Length"]@#;#~w@"Replace"~{"o"->"O"~z~n<>"n","re"->" "<>If[n>2,z["R",n-2],""]<>" n"})&





                      share|improve this answer





















                      • 1





                        A few improvements: StringRepeat can be Table since <> will convert the list into a string later; the If is unnecessary since we take the re branch only when n is at least 2; we can save on parentheses by defining n only when we use it. Try it online!

                        – Misha Lavrov
                        Jan 5 at 20:32











                      • @MishaLavrov The If was added because StringRepeat would throw an error on the case of "re"; it doesn't allow you to repeat a string 0 times. Table has no such limitation, so that's a big save!

                        – Mark S.
                        Jan 5 at 21:33














                      4












                      4








                      4







                      Mathematica, 111 91 bytes



                      #~StringReplace~{"o"->"O"~Table~(n=StringLength@#)<>"n","re"->" "<>Table["R",n-2]<>" n"}&


                      Try It Online!



                      This was majorly shortened thanks to Misha's edits.





                      My original code:



                      (z=StringRepeat;n=StringLength@#;#~StringReplace~{"o"->"O"~z~n<>"n","re"->" "<>If[n>2,z["R",n-2],""]<>" n"})&


                      This code is not very fancy but it seems too expensive to convert away from strings and then back or to do anything else clever.



                      In particular, with only 3-4 commands that have the name String, my original approach couldn't save bytes at all by trying to abstract that away. For example, the following is 129 bytes:



                      (w=Symbol["String"<>#]&;z=w@"Repeat";n=w["Length"]@#;#~w@"Replace"~{"o"->"O"~z~n<>"n","re"->" "<>If[n>2,z["R",n-2],""]<>" n"})&





                      share|improve this answer















                      Mathematica, 111 91 bytes



                      #~StringReplace~{"o"->"O"~Table~(n=StringLength@#)<>"n","re"->" "<>Table["R",n-2]<>" n"}&


                      Try It Online!



                      This was majorly shortened thanks to Misha's edits.





                      My original code:



                      (z=StringRepeat;n=StringLength@#;#~StringReplace~{"o"->"O"~z~n<>"n","re"->" "<>If[n>2,z["R",n-2],""]<>" n"})&


                      This code is not very fancy but it seems too expensive to convert away from strings and then back or to do anything else clever.



                      In particular, with only 3-4 commands that have the name String, my original approach couldn't save bytes at all by trying to abstract that away. For example, the following is 129 bytes:



                      (w=Symbol["String"<>#]&;z=w@"Repeat";n=w["Length"]@#;#~w@"Replace"~{"o"->"O"~z~n<>"n","re"->" "<>If[n>2,z["R",n-2],""]<>" n"})&






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jan 5 at 21:41

























                      answered Jan 5 at 1:41









                      Mark S.Mark S.

                      25117




                      25117








                      • 1





                        A few improvements: StringRepeat can be Table since <> will convert the list into a string later; the If is unnecessary since we take the re branch only when n is at least 2; we can save on parentheses by defining n only when we use it. Try it online!

                        – Misha Lavrov
                        Jan 5 at 20:32











                      • @MishaLavrov The If was added because StringRepeat would throw an error on the case of "re"; it doesn't allow you to repeat a string 0 times. Table has no such limitation, so that's a big save!

                        – Mark S.
                        Jan 5 at 21:33














                      • 1





                        A few improvements: StringRepeat can be Table since <> will convert the list into a string later; the If is unnecessary since we take the re branch only when n is at least 2; we can save on parentheses by defining n only when we use it. Try it online!

                        – Misha Lavrov
                        Jan 5 at 20:32











                      • @MishaLavrov The If was added because StringRepeat would throw an error on the case of "re"; it doesn't allow you to repeat a string 0 times. Table has no such limitation, so that's a big save!

                        – Mark S.
                        Jan 5 at 21:33








                      1




                      1





                      A few improvements: StringRepeat can be Table since <> will convert the list into a string later; the If is unnecessary since we take the re branch only when n is at least 2; we can save on parentheses by defining n only when we use it. Try it online!

                      – Misha Lavrov
                      Jan 5 at 20:32





                      A few improvements: StringRepeat can be Table since <> will convert the list into a string later; the If is unnecessary since we take the re branch only when n is at least 2; we can save on parentheses by defining n only when we use it. Try it online!

                      – Misha Lavrov
                      Jan 5 at 20:32













                      @MishaLavrov The If was added because StringRepeat would throw an error on the case of "re"; it doesn't allow you to repeat a string 0 times. Table has no such limitation, so that's a big save!

                      – Mark S.
                      Jan 5 at 21:33





                      @MishaLavrov The If was added because StringRepeat would throw an error on the case of "re"; it doesn't allow you to repeat a string 0 times. Table has no such limitation, so that's a big save!

                      – Mark S.
                      Jan 5 at 21:33











                      4















                      C (gcc), 135 113 109 104 bytes




                      • Saved twenty-two twenty-seven bytes thanks to NieDzejkob.

                      • Saved four bytes thanks to ceilingcat.


                      #define $ putchar(33
                      O(char*r){for(char*e,*o=r,x;*r;$-23))for(x=*r++>111,e=x?$-1),r++,o+2:o;*e++;$+x));}


                      Try it online!






                      share|improve this answer


























                      • Shave off a few bytes with -D$=putchar

                        – Rogem
                        Jan 4 at 13:55











                      • 131 bytes if you add a trailing newline as allowed by the rules.

                        – NieDzejkob
                        Jan 6 at 13:54











                      • 127 bytes if you move the e=o to the condition of the first for loop and then remove the else.

                        – NieDzejkob
                        Jan 6 at 14:20











                      • 118 bytes if you choose the cookie and filling characters carefully.

                        – NieDzejkob
                        Jan 6 at 14:58











                      • 113 bytes

                        – NieDzejkob
                        Jan 6 at 15:02


















                      4















                      C (gcc), 135 113 109 104 bytes




                      • Saved twenty-two twenty-seven bytes thanks to NieDzejkob.

                      • Saved four bytes thanks to ceilingcat.


                      #define $ putchar(33
                      O(char*r){for(char*e,*o=r,x;*r;$-23))for(x=*r++>111,e=x?$-1),r++,o+2:o;*e++;$+x));}


                      Try it online!






                      share|improve this answer


























                      • Shave off a few bytes with -D$=putchar

                        – Rogem
                        Jan 4 at 13:55











                      • 131 bytes if you add a trailing newline as allowed by the rules.

                        – NieDzejkob
                        Jan 6 at 13:54











                      • 127 bytes if you move the e=o to the condition of the first for loop and then remove the else.

                        – NieDzejkob
                        Jan 6 at 14:20











                      • 118 bytes if you choose the cookie and filling characters carefully.

                        – NieDzejkob
                        Jan 6 at 14:58











                      • 113 bytes

                        – NieDzejkob
                        Jan 6 at 15:02
















                      4












                      4








                      4








                      C (gcc), 135 113 109 104 bytes




                      • Saved twenty-two twenty-seven bytes thanks to NieDzejkob.

                      • Saved four bytes thanks to ceilingcat.


                      #define $ putchar(33
                      O(char*r){for(char*e,*o=r,x;*r;$-23))for(x=*r++>111,e=x?$-1),r++,o+2:o;*e++;$+x));}


                      Try it online!






                      share|improve this answer
















                      C (gcc), 135 113 109 104 bytes




                      • Saved twenty-two twenty-seven bytes thanks to NieDzejkob.

                      • Saved four bytes thanks to ceilingcat.


                      #define $ putchar(33
                      O(char*r){for(char*e,*o=r,x;*r;$-23))for(x=*r++>111,e=x?$-1),r++,o+2:o;*e++;$+x));}


                      Try it online!







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited 2 days ago









                      Erik the Outgolfer

                      31.5k429103




                      31.5k429103










                      answered Jan 4 at 4:33









                      Jonathan FrechJonathan Frech

                      6,22311040




                      6,22311040













                      • Shave off a few bytes with -D$=putchar

                        – Rogem
                        Jan 4 at 13:55











                      • 131 bytes if you add a trailing newline as allowed by the rules.

                        – NieDzejkob
                        Jan 6 at 13:54











                      • 127 bytes if you move the e=o to the condition of the first for loop and then remove the else.

                        – NieDzejkob
                        Jan 6 at 14:20











                      • 118 bytes if you choose the cookie and filling characters carefully.

                        – NieDzejkob
                        Jan 6 at 14:58











                      • 113 bytes

                        – NieDzejkob
                        Jan 6 at 15:02





















                      • Shave off a few bytes with -D$=putchar

                        – Rogem
                        Jan 4 at 13:55











                      • 131 bytes if you add a trailing newline as allowed by the rules.

                        – NieDzejkob
                        Jan 6 at 13:54











                      • 127 bytes if you move the e=o to the condition of the first for loop and then remove the else.

                        – NieDzejkob
                        Jan 6 at 14:20











                      • 118 bytes if you choose the cookie and filling characters carefully.

                        – NieDzejkob
                        Jan 6 at 14:58











                      • 113 bytes

                        – NieDzejkob
                        Jan 6 at 15:02



















                      Shave off a few bytes with -D$=putchar

                      – Rogem
                      Jan 4 at 13:55





                      Shave off a few bytes with -D$=putchar

                      – Rogem
                      Jan 4 at 13:55













                      131 bytes if you add a trailing newline as allowed by the rules.

                      – NieDzejkob
                      Jan 6 at 13:54





                      131 bytes if you add a trailing newline as allowed by the rules.

                      – NieDzejkob
                      Jan 6 at 13:54













                      127 bytes if you move the e=o to the condition of the first for loop and then remove the else.

                      – NieDzejkob
                      Jan 6 at 14:20





                      127 bytes if you move the e=o to the condition of the first for loop and then remove the else.

                      – NieDzejkob
                      Jan 6 at 14:20













                      118 bytes if you choose the cookie and filling characters carefully.

                      – NieDzejkob
                      Jan 6 at 14:58





                      118 bytes if you choose the cookie and filling characters carefully.

                      – NieDzejkob
                      Jan 6 at 14:58













                      113 bytes

                      – NieDzejkob
                      Jan 6 at 15:02







                      113 bytes

                      – NieDzejkob
                      Jan 6 at 15:02













                      3















                      Charcoal, 19 bytes



                      Fθ≡ιo⟦⭆θ#⟧e«→P⁻Lθ²↙


                      Try it online! Link is to verbose version of code. Explanation:



                      Fθ


                      Loop through the characters of the input string.



                      ≡ι


                      Switch on each character.



                      o⟦⭆θ#⟧


                      If it's an o then print the input string replaced with #s on its own line.



                      e«→P⁻Lθ²↙


                      If it's an e then move right, print a line of -s that's two less than the length of the input string, then move down and left.






                      share|improve this answer




























                        3















                        Charcoal, 19 bytes



                        Fθ≡ιo⟦⭆θ#⟧e«→P⁻Lθ²↙


                        Try it online! Link is to verbose version of code. Explanation:



                        Fθ


                        Loop through the characters of the input string.



                        ≡ι


                        Switch on each character.



                        o⟦⭆θ#⟧


                        If it's an o then print the input string replaced with #s on its own line.



                        e«→P⁻Lθ²↙


                        If it's an e then move right, print a line of -s that's two less than the length of the input string, then move down and left.






                        share|improve this answer


























                          3












                          3








                          3








                          Charcoal, 19 bytes



                          Fθ≡ιo⟦⭆θ#⟧e«→P⁻Lθ²↙


                          Try it online! Link is to verbose version of code. Explanation:



                          Fθ


                          Loop through the characters of the input string.



                          ≡ι


                          Switch on each character.



                          o⟦⭆θ#⟧


                          If it's an o then print the input string replaced with #s on its own line.



                          e«→P⁻Lθ²↙


                          If it's an e then move right, print a line of -s that's two less than the length of the input string, then move down and left.






                          share|improve this answer














                          Charcoal, 19 bytes



                          Fθ≡ιo⟦⭆θ#⟧e«→P⁻Lθ²↙


                          Try it online! Link is to verbose version of code. Explanation:



                          Fθ


                          Loop through the characters of the input string.



                          ≡ι


                          Switch on each character.



                          o⟦⭆θ#⟧


                          If it's an o then print the input string replaced with #s on its own line.



                          e«→P⁻Lθ²↙


                          If it's an e then move right, print a line of -s that's two less than the length of the input string, then move down and left.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 4 at 13:23









                          NeilNeil

                          79.7k744177




                          79.7k744177























                              3















                              Perl 5 -p, 47 bytes





                              s|o|X x($i=y///c).$/|ge;s|re|$".O x($i-2).$/|ge


                              Try it online!






                              share|improve this answer
























                              • This breaks the rules: "The whitespace padding on each side of the filling is required"

                                – NieDzejkob
                                Jan 6 at 15:16











                              • with some variations tio.run/##K0gtyjH9/…

                                – Nahuel Fouilleul
                                Jan 7 at 15:16
















                              3















                              Perl 5 -p, 47 bytes





                              s|o|X x($i=y///c).$/|ge;s|re|$".O x($i-2).$/|ge


                              Try it online!






                              share|improve this answer
























                              • This breaks the rules: "The whitespace padding on each side of the filling is required"

                                – NieDzejkob
                                Jan 6 at 15:16











                              • with some variations tio.run/##K0gtyjH9/…

                                – Nahuel Fouilleul
                                Jan 7 at 15:16














                              3












                              3








                              3








                              Perl 5 -p, 47 bytes





                              s|o|X x($i=y///c).$/|ge;s|re|$".O x($i-2).$/|ge


                              Try it online!






                              share|improve this answer














                              Perl 5 -p, 47 bytes





                              s|o|X x($i=y///c).$/|ge;s|re|$".O x($i-2).$/|ge


                              Try it online!







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jan 4 at 15:34









                              XcaliXcali

                              5,218520




                              5,218520













                              • This breaks the rules: "The whitespace padding on each side of the filling is required"

                                – NieDzejkob
                                Jan 6 at 15:16











                              • with some variations tio.run/##K0gtyjH9/…

                                – Nahuel Fouilleul
                                Jan 7 at 15:16



















                              • This breaks the rules: "The whitespace padding on each side of the filling is required"

                                – NieDzejkob
                                Jan 6 at 15:16











                              • with some variations tio.run/##K0gtyjH9/…

                                – Nahuel Fouilleul
                                Jan 7 at 15:16

















                              This breaks the rules: "The whitespace padding on each side of the filling is required"

                              – NieDzejkob
                              Jan 6 at 15:16





                              This breaks the rules: "The whitespace padding on each side of the filling is required"

                              – NieDzejkob
                              Jan 6 at 15:16













                              with some variations tio.run/##K0gtyjH9/…

                              – Nahuel Fouilleul
                              Jan 7 at 15:16





                              with some variations tio.run/##K0gtyjH9/…

                              – Nahuel Fouilleul
                              Jan 7 at 15:16











                              3














                              Bash, 87 bytes





                              Without sed:



                              f(){ printf %$1s|tr   $2;}
                              c=${1//o/`f ${#1} B`
                              }
                              echo "${c//re/ `f $[${#1}-2] F`
                              }"


                              Thanks to @manatwork.



                              With sed (90 bytes):



                              f(){ printf %$1s|tr   $2;}
                              echo $1|sed "s/o/`f ${#1} B`n/g;s/re/ `f $[${#1}-2] F` n/g"





                              share|improve this answer










                              New contributor




                              Green is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.





















                              • Could you show us some sample usage? I'm a bit confused by your function expecting 2 parameters.

                                – manatwork
                                Jan 6 at 18:34













                              • You write that into a script called test.sh. Then, you call test.sh from the command line as follows: bash test.sh oreoorererereoo. f is needed to repeat the character $2 $1 number of times

                                – Green
                                Jan 6 at 18:41













                              • Oops. I completely misunderstood function f. Some further minor changes could be made there: Try it online!

                                – manatwork
                                Jan 6 at 18:55






                              • 1





                                75 bytes.

                                – Dennis
                                Jan 7 at 4:15






                              • 1





                                60 bytes

                                – Nahuel Fouilleul
                                Jan 8 at 8:27
















                              3














                              Bash, 87 bytes





                              Without sed:



                              f(){ printf %$1s|tr   $2;}
                              c=${1//o/`f ${#1} B`
                              }
                              echo "${c//re/ `f $[${#1}-2] F`
                              }"


                              Thanks to @manatwork.



                              With sed (90 bytes):



                              f(){ printf %$1s|tr   $2;}
                              echo $1|sed "s/o/`f ${#1} B`n/g;s/re/ `f $[${#1}-2] F` n/g"





                              share|improve this answer










                              New contributor




                              Green is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.





















                              • Could you show us some sample usage? I'm a bit confused by your function expecting 2 parameters.

                                – manatwork
                                Jan 6 at 18:34













                              • You write that into a script called test.sh. Then, you call test.sh from the command line as follows: bash test.sh oreoorererereoo. f is needed to repeat the character $2 $1 number of times

                                – Green
                                Jan 6 at 18:41













                              • Oops. I completely misunderstood function f. Some further minor changes could be made there: Try it online!

                                – manatwork
                                Jan 6 at 18:55






                              • 1





                                75 bytes.

                                – Dennis
                                Jan 7 at 4:15






                              • 1





                                60 bytes

                                – Nahuel Fouilleul
                                Jan 8 at 8:27














                              3












                              3








                              3







                              Bash, 87 bytes





                              Without sed:



                              f(){ printf %$1s|tr   $2;}
                              c=${1//o/`f ${#1} B`
                              }
                              echo "${c//re/ `f $[${#1}-2] F`
                              }"


                              Thanks to @manatwork.



                              With sed (90 bytes):



                              f(){ printf %$1s|tr   $2;}
                              echo $1|sed "s/o/`f ${#1} B`n/g;s/re/ `f $[${#1}-2] F` n/g"





                              share|improve this answer










                              New contributor




                              Green is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.










                              Bash, 87 bytes





                              Without sed:



                              f(){ printf %$1s|tr   $2;}
                              c=${1//o/`f ${#1} B`
                              }
                              echo "${c//re/ `f $[${#1}-2] F`
                              }"


                              Thanks to @manatwork.



                              With sed (90 bytes):



                              f(){ printf %$1s|tr   $2;}
                              echo $1|sed "s/o/`f ${#1} B`n/g;s/re/ `f $[${#1}-2] F` n/g"






                              share|improve this answer










                              New contributor




                              Green is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.









                              share|improve this answer



                              share|improve this answer








                              edited Jan 6 at 21:20









                              Riker

                              5,98042767




                              5,98042767






                              New contributor




                              Green is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.









                              answered Jan 6 at 18:29









                              GreenGreen

                              312




                              312




                              New contributor




                              Green is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.





                              New contributor





                              Green is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.






                              Green is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                              Check out our Code of Conduct.













                              • Could you show us some sample usage? I'm a bit confused by your function expecting 2 parameters.

                                – manatwork
                                Jan 6 at 18:34













                              • You write that into a script called test.sh. Then, you call test.sh from the command line as follows: bash test.sh oreoorererereoo. f is needed to repeat the character $2 $1 number of times

                                – Green
                                Jan 6 at 18:41













                              • Oops. I completely misunderstood function f. Some further minor changes could be made there: Try it online!

                                – manatwork
                                Jan 6 at 18:55






                              • 1





                                75 bytes.

                                – Dennis
                                Jan 7 at 4:15






                              • 1





                                60 bytes

                                – Nahuel Fouilleul
                                Jan 8 at 8:27



















                              • Could you show us some sample usage? I'm a bit confused by your function expecting 2 parameters.

                                – manatwork
                                Jan 6 at 18:34













                              • You write that into a script called test.sh. Then, you call test.sh from the command line as follows: bash test.sh oreoorererereoo. f is needed to repeat the character $2 $1 number of times

                                – Green
                                Jan 6 at 18:41













                              • Oops. I completely misunderstood function f. Some further minor changes could be made there: Try it online!

                                – manatwork
                                Jan 6 at 18:55






                              • 1





                                75 bytes.

                                – Dennis
                                Jan 7 at 4:15






                              • 1





                                60 bytes

                                – Nahuel Fouilleul
                                Jan 8 at 8:27

















                              Could you show us some sample usage? I'm a bit confused by your function expecting 2 parameters.

                              – manatwork
                              Jan 6 at 18:34







                              Could you show us some sample usage? I'm a bit confused by your function expecting 2 parameters.

                              – manatwork
                              Jan 6 at 18:34















                              You write that into a script called test.sh. Then, you call test.sh from the command line as follows: bash test.sh oreoorererereoo. f is needed to repeat the character $2 $1 number of times

                              – Green
                              Jan 6 at 18:41







                              You write that into a script called test.sh. Then, you call test.sh from the command line as follows: bash test.sh oreoorererereoo. f is needed to repeat the character $2 $1 number of times

                              – Green
                              Jan 6 at 18:41















                              Oops. I completely misunderstood function f. Some further minor changes could be made there: Try it online!

                              – manatwork
                              Jan 6 at 18:55





                              Oops. I completely misunderstood function f. Some further minor changes could be made there: Try it online!

                              – manatwork
                              Jan 6 at 18:55




                              1




                              1





                              75 bytes.

                              – Dennis
                              Jan 7 at 4:15





                              75 bytes.

                              – Dennis
                              Jan 7 at 4:15




                              1




                              1





                              60 bytes

                              – Nahuel Fouilleul
                              Jan 8 at 8:27





                              60 bytes

                              – Nahuel Fouilleul
                              Jan 8 at 8:27











                              3















                              C# (Visual C# Interactive Compiler), 71 bytes





                              s=>s.Aggregate("",(a,c)=>a+(c>111?" ":"n".PadLeft(s.Length+c/5-21,c)))


                              Try it online!



                              Borrowed some ideas from on Embodiment of Ignorance's answer for sure.



                              -6 bytes thanks to @ASCIIOnly!



                              The overall concept is to compute a string aggregate over the input characters following these rules:




                              • If an r is encountered, append a single space character for indentation. We know the next character will be an e.

                              • If an o or an e is encountered, generate a string by repeating the current character a specific number of times and prepending it to a newline or some padding and a newline.

                              • The number of times to repeat is determined by length of input string and whether the current line is indented.

                              • The PadLeft function is used to generate the repeating character string.


                              The result is the concatenation of all of these strings.






                              share|improve this answer





















                              • 1





                                71

                                – ASCII-only
                                Jan 5 at 1:09











                              • @ASCIIOnly - Thanks :)

                                – dana
                                Jan 5 at 1:57











                              • > The whitespace padding on each side of the filling is required

                                – ASCII-only
                                Jan 5 at 4:57






                              • 1





                                85?

                                – ASCII-only
                                Jan 5 at 5:01











                              • I didn't notice that :) Although, in reviewing the posted answers about 1/2 have done this incorrectly as well. Good catch though!

                                – dana
                                Jan 5 at 5:08
















                              3















                              C# (Visual C# Interactive Compiler), 71 bytes





                              s=>s.Aggregate("",(a,c)=>a+(c>111?" ":"n".PadLeft(s.Length+c/5-21,c)))


                              Try it online!



                              Borrowed some ideas from on Embodiment of Ignorance's answer for sure.



                              -6 bytes thanks to @ASCIIOnly!



                              The overall concept is to compute a string aggregate over the input characters following these rules:




                              • If an r is encountered, append a single space character for indentation. We know the next character will be an e.

                              • If an o or an e is encountered, generate a string by repeating the current character a specific number of times and prepending it to a newline or some padding and a newline.

                              • The number of times to repeat is determined by length of input string and whether the current line is indented.

                              • The PadLeft function is used to generate the repeating character string.


                              The result is the concatenation of all of these strings.






                              share|improve this answer





















                              • 1





                                71

                                – ASCII-only
                                Jan 5 at 1:09











                              • @ASCIIOnly - Thanks :)

                                – dana
                                Jan 5 at 1:57











                              • > The whitespace padding on each side of the filling is required

                                – ASCII-only
                                Jan 5 at 4:57






                              • 1





                                85?

                                – ASCII-only
                                Jan 5 at 5:01











                              • I didn't notice that :) Although, in reviewing the posted answers about 1/2 have done this incorrectly as well. Good catch though!

                                – dana
                                Jan 5 at 5:08














                              3












                              3








                              3








                              C# (Visual C# Interactive Compiler), 71 bytes





                              s=>s.Aggregate("",(a,c)=>a+(c>111?" ":"n".PadLeft(s.Length+c/5-21,c)))


                              Try it online!



                              Borrowed some ideas from on Embodiment of Ignorance's answer for sure.



                              -6 bytes thanks to @ASCIIOnly!



                              The overall concept is to compute a string aggregate over the input characters following these rules:




                              • If an r is encountered, append a single space character for indentation. We know the next character will be an e.

                              • If an o or an e is encountered, generate a string by repeating the current character a specific number of times and prepending it to a newline or some padding and a newline.

                              • The number of times to repeat is determined by length of input string and whether the current line is indented.

                              • The PadLeft function is used to generate the repeating character string.


                              The result is the concatenation of all of these strings.






                              share|improve this answer
















                              C# (Visual C# Interactive Compiler), 71 bytes





                              s=>s.Aggregate("",(a,c)=>a+(c>111?" ":"n".PadLeft(s.Length+c/5-21,c)))


                              Try it online!



                              Borrowed some ideas from on Embodiment of Ignorance's answer for sure.



                              -6 bytes thanks to @ASCIIOnly!



                              The overall concept is to compute a string aggregate over the input characters following these rules:




                              • If an r is encountered, append a single space character for indentation. We know the next character will be an e.

                              • If an o or an e is encountered, generate a string by repeating the current character a specific number of times and prepending it to a newline or some padding and a newline.

                              • The number of times to repeat is determined by length of input string and whether the current line is indented.

                              • The PadLeft function is used to generate the repeating character string.


                              The result is the concatenation of all of these strings.







                              share|improve this answer














                              share|improve this answer



                              share|improve this answer








                              edited Jan 7 at 4:56

























                              answered Jan 4 at 22:34









                              danadana

                              58135




                              58135








                              • 1





                                71

                                – ASCII-only
                                Jan 5 at 1:09











                              • @ASCIIOnly - Thanks :)

                                – dana
                                Jan 5 at 1:57











                              • > The whitespace padding on each side of the filling is required

                                – ASCII-only
                                Jan 5 at 4:57






                              • 1





                                85?

                                – ASCII-only
                                Jan 5 at 5:01











                              • I didn't notice that :) Although, in reviewing the posted answers about 1/2 have done this incorrectly as well. Good catch though!

                                – dana
                                Jan 5 at 5:08














                              • 1





                                71

                                – ASCII-only
                                Jan 5 at 1:09











                              • @ASCIIOnly - Thanks :)

                                – dana
                                Jan 5 at 1:57











                              • > The whitespace padding on each side of the filling is required

                                – ASCII-only
                                Jan 5 at 4:57






                              • 1





                                85?

                                – ASCII-only
                                Jan 5 at 5:01











                              • I didn't notice that :) Although, in reviewing the posted answers about 1/2 have done this incorrectly as well. Good catch though!

                                – dana
                                Jan 5 at 5:08








                              1




                              1





                              71

                              – ASCII-only
                              Jan 5 at 1:09





                              71

                              – ASCII-only
                              Jan 5 at 1:09













                              @ASCIIOnly - Thanks :)

                              – dana
                              Jan 5 at 1:57





                              @ASCIIOnly - Thanks :)

                              – dana
                              Jan 5 at 1:57













                              > The whitespace padding on each side of the filling is required

                              – ASCII-only
                              Jan 5 at 4:57





                              > The whitespace padding on each side of the filling is required

                              – ASCII-only
                              Jan 5 at 4:57




                              1




                              1





                              85?

                              – ASCII-only
                              Jan 5 at 5:01





                              85?

                              – ASCII-only
                              Jan 5 at 5:01













                              I didn't notice that :) Although, in reviewing the posted answers about 1/2 have done this incorrectly as well. Good catch though!

                              – dana
                              Jan 5 at 5:08





                              I didn't notice that :) Although, in reviewing the posted answers about 1/2 have done this incorrectly as well. Good catch though!

                              – dana
                              Jan 5 at 5:08











                              3















                              Perl 6, 37 bytes





                              {m:g/o|r/>>.&({S/rr/ /.say}o*x.comb)}


                              Try it online!



                              Anonymous code block that takes a string and prints the oreo, with o as the cookie and r as the cream.



                              Explanation:



                              {                                   }   # Anonymous code block
                              m:g/o|r/ # Select all o s and r s
                              >>.&( ) # Map each letter to
                              *x.comb # The letter padded to the width
                              S/rr/ / # Substitute a leading rr with a space
                              .say # And print with a newline





                              share|improve this answer




























                                3















                                Perl 6, 37 bytes





                                {m:g/o|r/>>.&({S/rr/ /.say}o*x.comb)}


                                Try it online!



                                Anonymous code block that takes a string and prints the oreo, with o as the cookie and r as the cream.



                                Explanation:



                                {                                   }   # Anonymous code block
                                m:g/o|r/ # Select all o s and r s
                                >>.&( ) # Map each letter to
                                *x.comb # The letter padded to the width
                                S/rr/ / # Substitute a leading rr with a space
                                .say # And print with a newline





                                share|improve this answer


























                                  3












                                  3








                                  3








                                  Perl 6, 37 bytes





                                  {m:g/o|r/>>.&({S/rr/ /.say}o*x.comb)}


                                  Try it online!



                                  Anonymous code block that takes a string and prints the oreo, with o as the cookie and r as the cream.



                                  Explanation:



                                  {                                   }   # Anonymous code block
                                  m:g/o|r/ # Select all o s and r s
                                  >>.&( ) # Map each letter to
                                  *x.comb # The letter padded to the width
                                  S/rr/ / # Substitute a leading rr with a space
                                  .say # And print with a newline





                                  share|improve this answer














                                  Perl 6, 37 bytes





                                  {m:g/o|r/>>.&({S/rr/ /.say}o*x.comb)}


                                  Try it online!



                                  Anonymous code block that takes a string and prints the oreo, with o as the cookie and r as the cream.



                                  Explanation:



                                  {                                   }   # Anonymous code block
                                  m:g/o|r/ # Select all o s and r s
                                  >>.&( ) # Map each letter to
                                  *x.comb # The letter padded to the width
                                  S/rr/ / # Substitute a leading rr with a space
                                  .say # And print with a newline






                                  share|improve this answer












                                  share|improve this answer



                                  share|improve this answer










                                  answered Jan 8 at 3:25









                                  Jo KingJo King

                                  21.2k248110




                                  21.2k248110























                                      3














                                      Java 11, 110 bytes





                                      s->{int l=s.length();return s.replace("re"," "+"~".repeat(l-(l<2?1:2))+"n").replace("o","=".repeat(l)+"n");}


                                      Uses = for the cookie and ~ for the filling.



                                      Try it online.



                                      Explanation:



                                      s->{                       // Method with String as both parameter and return-type
                                      int l=s.length(); // Get the length of the input
                                      return s // Return the input
                                      .replace("re", // After we've replaced all "re" with:
                                      " " // A space
                                      +"~".repeat(l-(l<2?1:2))
                                      // Appended with length-2 amount of "~"
                                      // (or length-1 if the input-length was 1)
                                      +"n") // Appended with a newline
                                      .replace("o", // And we've also replaced all "o" with:
                                      "=".repeat(l) // Length amount of "="
                                      +"n");} // Appended with a newline




                                      The above solution uses a replace. The following maps over the characters of the input instead:



                                      Java 11, 113 112 bytes



                                      s->s.chars().forEach(c->{if(c>101)System.out.println((c>111?" ":"")+(""+(char)c).repeat(s.length()-2*(~c&1)));})


                                      -1 byte thanks to @Neil.



                                      Try it online.



                                      Explanation:



                                      s->                           // Method with String parameter and no return-type
                                      s.chars().forEach(c->{ // Loop over the characters as codepoint-integers
                                      if(c>101) // If it's not an 'e':
                                      System.out.println( // Print with trailing newline:
                                      (c>111? // If it's an 'r'
                                      " " // Start with a space
                                      : // Else (it's an 'o' instead)
                                      "") // Start with an empty string
                                      +(""+(char)c).repeat( // And append the character itself
                                      .repeat( // Repeated the following amount of times:
                                      s.length() // The input-length
                                      -2*(~c&1)));}) // Minus 2 if it's an "r", or 0 if it's an "o"





                                      share|improve this answer





















                                      • 1





                                        Can you use ~c&1?

                                        – Neil
                                        Jan 4 at 11:34











                                      • @Neil I indeed can, thanks.

                                        – Kevin Cruijssen
                                        Jan 4 at 11:57











                                      • This is invalid: "The whitespace padding on each side of the filling is required"

                                        – NieDzejkob
                                        Jan 6 at 15:15











                                      • @NieDzejkob Fixed.. Always nice to have changing specs during the challenge, sigh..

                                        – Kevin Cruijssen
                                        Jan 7 at 9:43











                                      • @KevinCruijssen not anymore :P

                                        – ASCII-only
                                        Jan 7 at 23:32
















                                      3














                                      Java 11, 110 bytes





                                      s->{int l=s.length();return s.replace("re"," "+"~".repeat(l-(l<2?1:2))+"n").replace("o","=".repeat(l)+"n");}


                                      Uses = for the cookie and ~ for the filling.



                                      Try it online.



                                      Explanation:



                                      s->{                       // Method with String as both parameter and return-type
                                      int l=s.length(); // Get the length of the input
                                      return s // Return the input
                                      .replace("re", // After we've replaced all "re" with:
                                      " " // A space
                                      +"~".repeat(l-(l<2?1:2))
                                      // Appended with length-2 amount of "~"
                                      // (or length-1 if the input-length was 1)
                                      +"n") // Appended with a newline
                                      .replace("o", // And we've also replaced all "o" with:
                                      "=".repeat(l) // Length amount of "="
                                      +"n");} // Appended with a newline




                                      The above solution uses a replace. The following maps over the characters of the input instead:



                                      Java 11, 113 112 bytes



                                      s->s.chars().forEach(c->{if(c>101)System.out.println((c>111?" ":"")+(""+(char)c).repeat(s.length()-2*(~c&1)));})


                                      -1 byte thanks to @Neil.



                                      Try it online.



                                      Explanation:



                                      s->                           // Method with String parameter and no return-type
                                      s.chars().forEach(c->{ // Loop over the characters as codepoint-integers
                                      if(c>101) // If it's not an 'e':
                                      System.out.println( // Print with trailing newline:
                                      (c>111? // If it's an 'r'
                                      " " // Start with a space
                                      : // Else (it's an 'o' instead)
                                      "") // Start with an empty string
                                      +(""+(char)c).repeat( // And append the character itself
                                      .repeat( // Repeated the following amount of times:
                                      s.length() // The input-length
                                      -2*(~c&1)));}) // Minus 2 if it's an "r", or 0 if it's an "o"





                                      share|improve this answer





















                                      • 1





                                        Can you use ~c&1?

                                        – Neil
                                        Jan 4 at 11:34











                                      • @Neil I indeed can, thanks.

                                        – Kevin Cruijssen
                                        Jan 4 at 11:57











                                      • This is invalid: "The whitespace padding on each side of the filling is required"

                                        – NieDzejkob
                                        Jan 6 at 15:15











                                      • @NieDzejkob Fixed.. Always nice to have changing specs during the challenge, sigh..

                                        – Kevin Cruijssen
                                        Jan 7 at 9:43











                                      • @KevinCruijssen not anymore :P

                                        – ASCII-only
                                        Jan 7 at 23:32














                                      3












                                      3








                                      3







                                      Java 11, 110 bytes





                                      s->{int l=s.length();return s.replace("re"," "+"~".repeat(l-(l<2?1:2))+"n").replace("o","=".repeat(l)+"n");}


                                      Uses = for the cookie and ~ for the filling.



                                      Try it online.



                                      Explanation:



                                      s->{                       // Method with String as both parameter and return-type
                                      int l=s.length(); // Get the length of the input
                                      return s // Return the input
                                      .replace("re", // After we've replaced all "re" with:
                                      " " // A space
                                      +"~".repeat(l-(l<2?1:2))
                                      // Appended with length-2 amount of "~"
                                      // (or length-1 if the input-length was 1)
                                      +"n") // Appended with a newline
                                      .replace("o", // And we've also replaced all "o" with:
                                      "=".repeat(l) // Length amount of "="
                                      +"n");} // Appended with a newline




                                      The above solution uses a replace. The following maps over the characters of the input instead:



                                      Java 11, 113 112 bytes



                                      s->s.chars().forEach(c->{if(c>101)System.out.println((c>111?" ":"")+(""+(char)c).repeat(s.length()-2*(~c&1)));})


                                      -1 byte thanks to @Neil.



                                      Try it online.



                                      Explanation:



                                      s->                           // Method with String parameter and no return-type
                                      s.chars().forEach(c->{ // Loop over the characters as codepoint-integers
                                      if(c>101) // If it's not an 'e':
                                      System.out.println( // Print with trailing newline:
                                      (c>111? // If it's an 'r'
                                      " " // Start with a space
                                      : // Else (it's an 'o' instead)
                                      "") // Start with an empty string
                                      +(""+(char)c).repeat( // And append the character itself
                                      .repeat( // Repeated the following amount of times:
                                      s.length() // The input-length
                                      -2*(~c&1)));}) // Minus 2 if it's an "r", or 0 if it's an "o"





                                      share|improve this answer















                                      Java 11, 110 bytes





                                      s->{int l=s.length();return s.replace("re"," "+"~".repeat(l-(l<2?1:2))+"n").replace("o","=".repeat(l)+"n");}


                                      Uses = for the cookie and ~ for the filling.



                                      Try it online.



                                      Explanation:



                                      s->{                       // Method with String as both parameter and return-type
                                      int l=s.length(); // Get the length of the input
                                      return s // Return the input
                                      .replace("re", // After we've replaced all "re" with:
                                      " " // A space
                                      +"~".repeat(l-(l<2?1:2))
                                      // Appended with length-2 amount of "~"
                                      // (or length-1 if the input-length was 1)
                                      +"n") // Appended with a newline
                                      .replace("o", // And we've also replaced all "o" with:
                                      "=".repeat(l) // Length amount of "="
                                      +"n");} // Appended with a newline




                                      The above solution uses a replace. The following maps over the characters of the input instead:



                                      Java 11, 113 112 bytes



                                      s->s.chars().forEach(c->{if(c>101)System.out.println((c>111?" ":"")+(""+(char)c).repeat(s.length()-2*(~c&1)));})


                                      -1 byte thanks to @Neil.



                                      Try it online.



                                      Explanation:



                                      s->                           // Method with String parameter and no return-type
                                      s.chars().forEach(c->{ // Loop over the characters as codepoint-integers
                                      if(c>101) // If it's not an 'e':
                                      System.out.println( // Print with trailing newline:
                                      (c>111? // If it's an 'r'
                                      " " // Start with a space
                                      : // Else (it's an 'o' instead)
                                      "") // Start with an empty string
                                      +(""+(char)c).repeat( // And append the character itself
                                      .repeat( // Repeated the following amount of times:
                                      s.length() // The input-length
                                      -2*(~c&1)));}) // Minus 2 if it's an "r", or 0 if it's an "o"






                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Jan 8 at 7:46

























                                      answered Jan 4 at 10:22









                                      Kevin CruijssenKevin Cruijssen

                                      36.2k554190




                                      36.2k554190








                                      • 1





                                        Can you use ~c&1?

                                        – Neil
                                        Jan 4 at 11:34











                                      • @Neil I indeed can, thanks.

                                        – Kevin Cruijssen
                                        Jan 4 at 11:57











                                      • This is invalid: "The whitespace padding on each side of the filling is required"

                                        – NieDzejkob
                                        Jan 6 at 15:15











                                      • @NieDzejkob Fixed.. Always nice to have changing specs during the challenge, sigh..

                                        – Kevin Cruijssen
                                        Jan 7 at 9:43











                                      • @KevinCruijssen not anymore :P

                                        – ASCII-only
                                        Jan 7 at 23:32














                                      • 1





                                        Can you use ~c&1?

                                        – Neil
                                        Jan 4 at 11:34











                                      • @Neil I indeed can, thanks.

                                        – Kevin Cruijssen
                                        Jan 4 at 11:57











                                      • This is invalid: "The whitespace padding on each side of the filling is required"

                                        – NieDzejkob
                                        Jan 6 at 15:15











                                      • @NieDzejkob Fixed.. Always nice to have changing specs during the challenge, sigh..

                                        – Kevin Cruijssen
                                        Jan 7 at 9:43











                                      • @KevinCruijssen not anymore :P

                                        – ASCII-only
                                        Jan 7 at 23:32








                                      1




                                      1





                                      Can you use ~c&1?

                                      – Neil
                                      Jan 4 at 11:34





                                      Can you use ~c&1?

                                      – Neil
                                      Jan 4 at 11:34













                                      @Neil I indeed can, thanks.

                                      – Kevin Cruijssen
                                      Jan 4 at 11:57





                                      @Neil I indeed can, thanks.

                                      – Kevin Cruijssen
                                      Jan 4 at 11:57













                                      This is invalid: "The whitespace padding on each side of the filling is required"

                                      – NieDzejkob
                                      Jan 6 at 15:15





                                      This is invalid: "The whitespace padding on each side of the filling is required"

                                      – NieDzejkob
                                      Jan 6 at 15:15













                                      @NieDzejkob Fixed.. Always nice to have changing specs during the challenge, sigh..

                                      – Kevin Cruijssen
                                      Jan 7 at 9:43





                                      @NieDzejkob Fixed.. Always nice to have changing specs during the challenge, sigh..

                                      – Kevin Cruijssen
                                      Jan 7 at 9:43













                                      @KevinCruijssen not anymore :P

                                      – ASCII-only
                                      Jan 7 at 23:32





                                      @KevinCruijssen not anymore :P

                                      – ASCII-only
                                      Jan 7 at 23:32











                                      3















                                      PHP, 100 99 93 bytes





                                      $l=strlen($i=$argv[1]);$r=str_repeat;echo strtr($i,[o=>$r(X,$l)."
                                      ",re=>' '.$r(o,$l-2)."
                                      "]);


                                      Try it online!



                                      OUCH. PHP's waaaay_too_long function names strike again!



                                      Output:



                                      $php oreo.php oreo
                                      XXXX
                                      oo
                                      XXXX

                                      $php oreo.php o
                                      X

                                      $php oreo.php rere
                                      oo
                                      oo

                                      $ php oreo.php oreoorererereoo
                                      XXXXXXXXXXXXXXX
                                      ooooooooooooo
                                      XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX
                                      ooooooooooooo
                                      ooooooooooooo
                                      ooooooooooooo
                                      ooooooooooooo
                                      XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX





                                      share|improve this answer


























                                      • Invalid, cream lines need a trailing space

                                        – ASCII-only
                                        Jan 5 at 5:03











                                      • Fixed the trailing space. Thanks!

                                        – gwaugh
                                        Jan 5 at 12:09






                                      • 1





                                        Oh boy, PHP! Also any trailing whitespace is now optional, there were enough people that pointed out that since it's printing out ascii it shouldn't really be required.

                                        – GammaGames
                                        Jan 7 at 3:26
















                                      3















                                      PHP, 100 99 93 bytes





                                      $l=strlen($i=$argv[1]);$r=str_repeat;echo strtr($i,[o=>$r(X,$l)."
                                      ",re=>' '.$r(o,$l-2)."
                                      "]);


                                      Try it online!



                                      OUCH. PHP's waaaay_too_long function names strike again!



                                      Output:



                                      $php oreo.php oreo
                                      XXXX
                                      oo
                                      XXXX

                                      $php oreo.php o
                                      X

                                      $php oreo.php rere
                                      oo
                                      oo

                                      $ php oreo.php oreoorererereoo
                                      XXXXXXXXXXXXXXX
                                      ooooooooooooo
                                      XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX
                                      ooooooooooooo
                                      ooooooooooooo
                                      ooooooooooooo
                                      ooooooooooooo
                                      XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX





                                      share|improve this answer


























                                      • Invalid, cream lines need a trailing space

                                        – ASCII-only
                                        Jan 5 at 5:03











                                      • Fixed the trailing space. Thanks!

                                        – gwaugh
                                        Jan 5 at 12:09






                                      • 1





                                        Oh boy, PHP! Also any trailing whitespace is now optional, there were enough people that pointed out that since it's printing out ascii it shouldn't really be required.

                                        – GammaGames
                                        Jan 7 at 3:26














                                      3












                                      3








                                      3








                                      PHP, 100 99 93 bytes





                                      $l=strlen($i=$argv[1]);$r=str_repeat;echo strtr($i,[o=>$r(X,$l)."
                                      ",re=>' '.$r(o,$l-2)."
                                      "]);


                                      Try it online!



                                      OUCH. PHP's waaaay_too_long function names strike again!



                                      Output:



                                      $php oreo.php oreo
                                      XXXX
                                      oo
                                      XXXX

                                      $php oreo.php o
                                      X

                                      $php oreo.php rere
                                      oo
                                      oo

                                      $ php oreo.php oreoorererereoo
                                      XXXXXXXXXXXXXXX
                                      ooooooooooooo
                                      XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX
                                      ooooooooooooo
                                      ooooooooooooo
                                      ooooooooooooo
                                      ooooooooooooo
                                      XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX





                                      share|improve this answer
















                                      PHP, 100 99 93 bytes





                                      $l=strlen($i=$argv[1]);$r=str_repeat;echo strtr($i,[o=>$r(X,$l)."
                                      ",re=>' '.$r(o,$l-2)."
                                      "]);


                                      Try it online!



                                      OUCH. PHP's waaaay_too_long function names strike again!



                                      Output:



                                      $php oreo.php oreo
                                      XXXX
                                      oo
                                      XXXX

                                      $php oreo.php o
                                      X

                                      $php oreo.php rere
                                      oo
                                      oo

                                      $ php oreo.php oreoorererereoo
                                      XXXXXXXXXXXXXXX
                                      ooooooooooooo
                                      XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX
                                      ooooooooooooo
                                      ooooooooooooo
                                      ooooooooooooo
                                      ooooooooooooo
                                      XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX






                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited 2 days ago

























                                      answered Jan 5 at 0:07









                                      gwaughgwaugh

                                      3213




                                      3213













                                      • Invalid, cream lines need a trailing space

                                        – ASCII-only
                                        Jan 5 at 5:03











                                      • Fixed the trailing space. Thanks!

                                        – gwaugh
                                        Jan 5 at 12:09






                                      • 1





                                        Oh boy, PHP! Also any trailing whitespace is now optional, there were enough people that pointed out that since it's printing out ascii it shouldn't really be required.

                                        – GammaGames
                                        Jan 7 at 3:26



















                                      • Invalid, cream lines need a trailing space

                                        – ASCII-only
                                        Jan 5 at 5:03











                                      • Fixed the trailing space. Thanks!

                                        – gwaugh
                                        Jan 5 at 12:09






                                      • 1





                                        Oh boy, PHP! Also any trailing whitespace is now optional, there were enough people that pointed out that since it's printing out ascii it shouldn't really be required.

                                        – GammaGames
                                        Jan 7 at 3:26

















                                      Invalid, cream lines need a trailing space

                                      – ASCII-only
                                      Jan 5 at 5:03





                                      Invalid, cream lines need a trailing space

                                      – ASCII-only
                                      Jan 5 at 5:03













                                      Fixed the trailing space. Thanks!

                                      – gwaugh
                                      Jan 5 at 12:09





                                      Fixed the trailing space. Thanks!

                                      – gwaugh
                                      Jan 5 at 12:09




                                      1




                                      1





                                      Oh boy, PHP! Also any trailing whitespace is now optional, there were enough people that pointed out that since it's printing out ascii it shouldn't really be required.

                                      – GammaGames
                                      Jan 7 at 3:26





                                      Oh boy, PHP! Also any trailing whitespace is now optional, there were enough people that pointed out that since it's printing out ascii it shouldn't really be required.

                                      – GammaGames
                                      Jan 7 at 3:26











                                      3















                                      PHP, 96 87 85 bytes



                                      Thanks to @gwaugh -9 Bytes

                                      Thanks to @manatwork -2 Bytes





                                      <?=strtr($i=$argv[1],[o=>($r=str_repeat)(X,$l=strlen($i))."
                                      ",re=>" {$r(o,$l-2)}
                                      "]);


                                      Try it online!



                                      Try it online! (87 Bytes)



                                      Try it online (original 97 bytes submition)!




                                      And a recursive function


                                      PHP, 135 bytes





                                      function f($w,$x=0){$f=str_repeat;echo($x<($l=strlen($w)))?($w[$x]=='o')?$f(█,$l)."
                                      ".f($w,$x+1):" ".$f(░,$l-2)."
                                      ".f($w,$x+2):"";}


                                      Try it online! (recursive)






                                      share|improve this answer





















                                      • 1





                                        by combining the best of our two submissions I was able to get it down to 87 bytes TIO. Would you be game to go in with this as a collaborative submission? :)

                                        – gwaugh
                                        2 days ago








                                      • 1





                                        I think we can remove 1 more byte by using the command short_tag_open, and instead of <?= we can use <?, or am i mistaken?

                                        – Francisco Hahn
                                        2 days ago






                                      • 1





                                        2 characters shorter with string interpolation: ' '.$r(o,$l-2)."␤"" {$r(o,$l-2)}␤".

                                        – manatwork
                                        2 days ago











                                      • Thanks @manatwork sometimes i forgot php vars are evaluated in a string if the entire string is declared with "" istead of ''

                                        – Francisco Hahn
                                        2 days ago
















                                      3















                                      PHP, 96 87 85 bytes



                                      Thanks to @gwaugh -9 Bytes

                                      Thanks to @manatwork -2 Bytes





                                      <?=strtr($i=$argv[1],[o=>($r=str_repeat)(X,$l=strlen($i))."
                                      ",re=>" {$r(o,$l-2)}
                                      "]);


                                      Try it online!



                                      Try it online! (87 Bytes)



                                      Try it online (original 97 bytes submition)!




                                      And a recursive function


                                      PHP, 135 bytes





                                      function f($w,$x=0){$f=str_repeat;echo($x<($l=strlen($w)))?($w[$x]=='o')?$f(█,$l)."
                                      ".f($w,$x+1):" ".$f(░,$l-2)."
                                      ".f($w,$x+2):"";}


                                      Try it online! (recursive)






                                      share|improve this answer





















                                      • 1





                                        by combining the best of our two submissions I was able to get it down to 87 bytes TIO. Would you be game to go in with this as a collaborative submission? :)

                                        – gwaugh
                                        2 days ago








                                      • 1





                                        I think we can remove 1 more byte by using the command short_tag_open, and instead of <?= we can use <?, or am i mistaken?

                                        – Francisco Hahn
                                        2 days ago






                                      • 1





                                        2 characters shorter with string interpolation: ' '.$r(o,$l-2)."␤"" {$r(o,$l-2)}␤".

                                        – manatwork
                                        2 days ago











                                      • Thanks @manatwork sometimes i forgot php vars are evaluated in a string if the entire string is declared with "" istead of ''

                                        – Francisco Hahn
                                        2 days ago














                                      3












                                      3








                                      3








                                      PHP, 96 87 85 bytes



                                      Thanks to @gwaugh -9 Bytes

                                      Thanks to @manatwork -2 Bytes





                                      <?=strtr($i=$argv[1],[o=>($r=str_repeat)(X,$l=strlen($i))."
                                      ",re=>" {$r(o,$l-2)}
                                      "]);


                                      Try it online!



                                      Try it online! (87 Bytes)



                                      Try it online (original 97 bytes submition)!




                                      And a recursive function


                                      PHP, 135 bytes





                                      function f($w,$x=0){$f=str_repeat;echo($x<($l=strlen($w)))?($w[$x]=='o')?$f(█,$l)."
                                      ".f($w,$x+1):" ".$f(░,$l-2)."
                                      ".f($w,$x+2):"";}


                                      Try it online! (recursive)






                                      share|improve this answer
















                                      PHP, 96 87 85 bytes



                                      Thanks to @gwaugh -9 Bytes

                                      Thanks to @manatwork -2 Bytes





                                      <?=strtr($i=$argv[1],[o=>($r=str_repeat)(X,$l=strlen($i))."
                                      ",re=>" {$r(o,$l-2)}
                                      "]);


                                      Try it online!



                                      Try it online! (87 Bytes)



                                      Try it online (original 97 bytes submition)!




                                      And a recursive function


                                      PHP, 135 bytes





                                      function f($w,$x=0){$f=str_repeat;echo($x<($l=strlen($w)))?($w[$x]=='o')?$f(█,$l)."
                                      ".f($w,$x+1):" ".$f(░,$l-2)."
                                      ".f($w,$x+2):"";}


                                      Try it online! (recursive)







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited 2 days ago

























                                      answered Jan 7 at 21:05









                                      Francisco HahnFrancisco Hahn

                                      4769




                                      4769








                                      • 1





                                        by combining the best of our two submissions I was able to get it down to 87 bytes TIO. Would you be game to go in with this as a collaborative submission? :)

                                        – gwaugh
                                        2 days ago








                                      • 1





                                        I think we can remove 1 more byte by using the command short_tag_open, and instead of <?= we can use <?, or am i mistaken?

                                        – Francisco Hahn
                                        2 days ago






                                      • 1





                                        2 characters shorter with string interpolation: ' '.$r(o,$l-2)."␤"" {$r(o,$l-2)}␤".

                                        – manatwork
                                        2 days ago











                                      • Thanks @manatwork sometimes i forgot php vars are evaluated in a string if the entire string is declared with "" istead of ''

                                        – Francisco Hahn
                                        2 days ago














                                      • 1





                                        by combining the best of our two submissions I was able to get it down to 87 bytes TIO. Would you be game to go in with this as a collaborative submission? :)

                                        – gwaugh
                                        2 days ago








                                      • 1





                                        I think we can remove 1 more byte by using the command short_tag_open, and instead of <?= we can use <?, or am i mistaken?

                                        – Francisco Hahn
                                        2 days ago






                                      • 1





                                        2 characters shorter with string interpolation: ' '.$r(o,$l-2)."␤"" {$r(o,$l-2)}␤".

                                        – manatwork
                                        2 days ago











                                      • Thanks @manatwork sometimes i forgot php vars are evaluated in a string if the entire string is declared with "" istead of ''

                                        – Francisco Hahn
                                        2 days ago








                                      1




                                      1





                                      by combining the best of our two submissions I was able to get it down to 87 bytes TIO. Would you be game to go in with this as a collaborative submission? :)

                                      – gwaugh
                                      2 days ago







                                      by combining the best of our two submissions I was able to get it down to 87 bytes TIO. Would you be game to go in with this as a collaborative submission? :)

                                      – gwaugh
                                      2 days ago






                                      1




                                      1





                                      I think we can remove 1 more byte by using the command short_tag_open, and instead of <?= we can use <?, or am i mistaken?

                                      – Francisco Hahn
                                      2 days ago





                                      I think we can remove 1 more byte by using the command short_tag_open, and instead of <?= we can use <?, or am i mistaken?

                                      – Francisco Hahn
                                      2 days ago




                                      1




                                      1





                                      2 characters shorter with string interpolation: ' '.$r(o,$l-2)."␤"" {$r(o,$l-2)}␤".

                                      – manatwork
                                      2 days ago





                                      2 characters shorter with string interpolation: ' '.$r(o,$l-2)."␤"" {$r(o,$l-2)}␤".

                                      – manatwork
                                      2 days ago













                                      Thanks @manatwork sometimes i forgot php vars are evaluated in a string if the entire string is declared with "" istead of ''

                                      – Francisco Hahn
                                      2 days ago





                                      Thanks @manatwork sometimes i forgot php vars are evaluated in a string if the entire string is declared with "" istead of ''

                                      – Francisco Hahn
                                      2 days ago











                                      3














                                      JavaScript, 72 65 64 bytes



                                      s=>s.replace(/.e?/g,([x,y])=>(y?`
                                      `:`
                                      `).padEnd(s.length+!y,x))


                                      Try it online






                                      share|improve this answer






























                                        3














                                        JavaScript, 72 65 64 bytes



                                        s=>s.replace(/.e?/g,([x,y])=>(y?`
                                        `:`
                                        `).padEnd(s.length+!y,x))


                                        Try it online






                                        share|improve this answer




























                                          3












                                          3








                                          3







                                          JavaScript, 72 65 64 bytes



                                          s=>s.replace(/.e?/g,([x,y])=>(y?`
                                          `:`
                                          `).padEnd(s.length+!y,x))


                                          Try it online






                                          share|improve this answer















                                          JavaScript, 72 65 64 bytes



                                          s=>s.replace(/.e?/g,([x,y])=>(y?`
                                          `:`
                                          `).padEnd(s.length+!y,x))


                                          Try it online







                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited yesterday

























                                          answered Jan 4 at 10:46









                                          ShaggyShaggy

                                          19.2k21666




                                          19.2k21666























                                              2















                                              C# (.NET Core), 143 bytes



                                              Without LINQ.





                                              p=>{var q="";foreach(char c in p){if(c!='e'){for(var j=0;j<p.Length;j++)q+=(j<1|j>p.Length-2)&c>'q'?" ":c<'p'?"█":"░";q+="n";}}return q;};


                                              Try it online!






                                              share|improve this answer




























                                                2















                                                C# (.NET Core), 143 bytes



                                                Without LINQ.





                                                p=>{var q="";foreach(char c in p){if(c!='e'){for(var j=0;j<p.Length;j++)q+=(j<1|j>p.Length-2)&c>'q'?" ":c<'p'?"█":"░";q+="n";}}return q;};


                                                Try it online!






                                                share|improve this answer


























                                                  2












                                                  2








                                                  2








                                                  C# (.NET Core), 143 bytes



                                                  Without LINQ.





                                                  p=>{var q="";foreach(char c in p){if(c!='e'){for(var j=0;j<p.Length;j++)q+=(j<1|j>p.Length-2)&c>'q'?" ":c<'p'?"█":"░";q+="n";}}return q;};


                                                  Try it online!






                                                  share|improve this answer














                                                  C# (.NET Core), 143 bytes



                                                  Without LINQ.





                                                  p=>{var q="";foreach(char c in p){if(c!='e'){for(var j=0;j<p.Length;j++)q+=(j<1|j>p.Length-2)&c>'q'?" ":c<'p'?"█":"░";q+="n";}}return q;};


                                                  Try it online!







                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered Jan 4 at 16:56









                                                  DestroigoDestroigo

                                                  1515




                                                  1515























                                                      2















                                                      Clojure, 137 bytes





                                                      (fn[f](let[w(count f)r #(apply str(repeat % %2))](clojure.string/join"n"(replace{o(r w #)e(str  (r(- w 2)-)  )}(remove #{r}f)))))


                                                      I'm not using the nice characters in the printout in the golfed version since those are expensive. Returns a string to be printed.



                                                      Try it online!



                                                      See below for explanation.



                                                      Pre-golfed:



                                                      ; Backslashes indicate a character literal
                                                      (defn oreo [format-str]
                                                      (let [width (count format-str)

                                                      ; A helper function since Clojure doesn't have built-in string multiplication
                                                      str-repeat #(apply str (repeat % %2))

                                                      ; Define the layers
                                                      cookie (str-repeat width █)
                                                      cream (str (str-repeat (- width 2) ░) )]

                                                      (->> format-str ; Take the input string,
                                                      (remove #{r}) ; remove r for simplcity,
                                                      (replace {o cookie, e cream}) ; replace the remaining letters with the layers,
                                                      (clojure.string/join "n")))) ; and join the layers together with newlines





                                                      share|improve this answer




























                                                        2















                                                        Clojure, 137 bytes





                                                        (fn[f](let[w(count f)r #(apply str(repeat % %2))](clojure.string/join"n"(replace{o(r w #)e(str  (r(- w 2)-)  )}(remove #{r}f)))))


                                                        I'm not using the nice characters in the printout in the golfed version since those are expensive. Returns a string to be printed.



                                                        Try it online!



                                                        See below for explanation.



                                                        Pre-golfed:



                                                        ; Backslashes indicate a character literal
                                                        (defn oreo [format-str]
                                                        (let [width (count format-str)

                                                        ; A helper function since Clojure doesn't have built-in string multiplication
                                                        str-repeat #(apply str (repeat % %2))

                                                        ; Define the layers
                                                        cookie (str-repeat width █)
                                                        cream (str (str-repeat (- width 2) ░) )]

                                                        (->> format-str ; Take the input string,
                                                        (remove #{r}) ; remove r for simplcity,
                                                        (replace {o cookie, e cream}) ; replace the remaining letters with the layers,
                                                        (clojure.string/join "n")))) ; and join the layers together with newlines





                                                        share|improve this answer


























                                                          2












                                                          2








                                                          2








                                                          Clojure, 137 bytes





                                                          (fn[f](let[w(count f)r #(apply str(repeat % %2))](clojure.string/join"n"(replace{o(r w #)e(str  (r(- w 2)-)  )}(remove #{r}f)))))


                                                          I'm not using the nice characters in the printout in the golfed version since those are expensive. Returns a string to be printed.



                                                          Try it online!



                                                          See below for explanation.



                                                          Pre-golfed:



                                                          ; Backslashes indicate a character literal
                                                          (defn oreo [format-str]
                                                          (let [width (count format-str)

                                                          ; A helper function since Clojure doesn't have built-in string multiplication
                                                          str-repeat #(apply str (repeat % %2))

                                                          ; Define the layers
                                                          cookie (str-repeat width █)
                                                          cream (str (str-repeat (- width 2) ░) )]

                                                          (->> format-str ; Take the input string,
                                                          (remove #{r}) ; remove r for simplcity,
                                                          (replace {o cookie, e cream}) ; replace the remaining letters with the layers,
                                                          (clojure.string/join "n")))) ; and join the layers together with newlines





                                                          share|improve this answer














                                                          Clojure, 137 bytes





                                                          (fn[f](let[w(count f)r #(apply str(repeat % %2))](clojure.string/join"n"(replace{o(r w #)e(str  (r(- w 2)-)  )}(remove #{r}f)))))


                                                          I'm not using the nice characters in the printout in the golfed version since those are expensive. Returns a string to be printed.



                                                          Try it online!



                                                          See below for explanation.



                                                          Pre-golfed:



                                                          ; Backslashes indicate a character literal
                                                          (defn oreo [format-str]
                                                          (let [width (count format-str)

                                                          ; A helper function since Clojure doesn't have built-in string multiplication
                                                          str-repeat #(apply str (repeat % %2))

                                                          ; Define the layers
                                                          cookie (str-repeat width █)
                                                          cream (str (str-repeat (- width 2) ░) )]

                                                          (->> format-str ; Take the input string,
                                                          (remove #{r}) ; remove r for simplcity,
                                                          (replace {o cookie, e cream}) ; replace the remaining letters with the layers,
                                                          (clojure.string/join "n")))) ; and join the layers together with newlines






                                                          share|improve this answer












                                                          share|improve this answer



                                                          share|improve this answer










                                                          answered Jan 6 at 21:45









                                                          CarcigenicateCarcigenicate

                                                          2,28911224




                                                          2,28911224























                                                              2















                                                              Dart, 120 106 107 bytes



                                                              f(s)=>s.replaceAll('o',''.padRight(s.length,'#')+'n').replaceAll('re',' '.padRight(s.length-1,'-')+' n');


                                                              Try it online!




                                                              • +1 byte : Added trailing whitespace






                                                              share|improve this answer


























                                                              • This is invalid: "The whitespace padding on each side of the filling is required"

                                                                – NieDzejkob
                                                                Jan 6 at 15:15











                                                              • Oh, never mind then, I'll correct it soon. Thanks for the info, I missed it

                                                                – Elcan
                                                                Jan 6 at 22:14
















                                                              2















                                                              Dart, 120 106 107 bytes



                                                              f(s)=>s.replaceAll('o',''.padRight(s.length,'#')+'n').replaceAll('re',' '.padRight(s.length-1,'-')+' n');


                                                              Try it online!




                                                              • +1 byte : Added trailing whitespace






                                                              share|improve this answer


























                                                              • This is invalid: "The whitespace padding on each side of the filling is required"

                                                                – NieDzejkob
                                                                Jan 6 at 15:15











                                                              • Oh, never mind then, I'll correct it soon. Thanks for the info, I missed it

                                                                – Elcan
                                                                Jan 6 at 22:14














                                                              2












                                                              2








                                                              2








                                                              Dart, 120 106 107 bytes



                                                              f(s)=>s.replaceAll('o',''.padRight(s.length,'#')+'n').replaceAll('re',' '.padRight(s.length-1,'-')+' n');


                                                              Try it online!




                                                              • +1 byte : Added trailing whitespace






                                                              share|improve this answer
















                                                              Dart, 120 106 107 bytes



                                                              f(s)=>s.replaceAll('o',''.padRight(s.length,'#')+'n').replaceAll('re',' '.padRight(s.length-1,'-')+' n');


                                                              Try it online!




                                                              • +1 byte : Added trailing whitespace







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited Jan 6 at 23:01

























                                                              answered Jan 4 at 8:03









                                                              ElcanElcan

                                                              32115




                                                              32115













                                                              • This is invalid: "The whitespace padding on each side of the filling is required"

                                                                – NieDzejkob
                                                                Jan 6 at 15:15











                                                              • Oh, never mind then, I'll correct it soon. Thanks for the info, I missed it

                                                                – Elcan
                                                                Jan 6 at 22:14



















                                                              • This is invalid: "The whitespace padding on each side of the filling is required"

                                                                – NieDzejkob
                                                                Jan 6 at 15:15











                                                              • Oh, never mind then, I'll correct it soon. Thanks for the info, I missed it

                                                                – Elcan
                                                                Jan 6 at 22:14

















                                                              This is invalid: "The whitespace padding on each side of the filling is required"

                                                              – NieDzejkob
                                                              Jan 6 at 15:15





                                                              This is invalid: "The whitespace padding on each side of the filling is required"

                                                              – NieDzejkob
                                                              Jan 6 at 15:15













                                                              Oh, never mind then, I'll correct it soon. Thanks for the info, I missed it

                                                              – Elcan
                                                              Jan 6 at 22:14





                                                              Oh, never mind then, I'll correct it soon. Thanks for the info, I missed it

                                                              – Elcan
                                                              Jan 6 at 22:14











                                                              2















                                                              Python 2, 77 76 72 bytes





                                                              lambda i:'n'.join((x*len(i),' '+x*(len(i)-2))[x>'o']for x in i if'e'<x)


                                                              Try it online!



                                                              The outer part of the cookie is 'o' and the filling is 'r'.






                                                              share|improve this answer


























                                                              • 68 bytes. Although I doubt if you can really omit the trailing spaces, the spec does say "The whitespace padding on each side of the filling is required"...

                                                                – Erik the Outgolfer
                                                                Jan 5 at 22:35











                                                              • Thanks @EriktheOutgolfer. Thought a lambda would be shorter! Guess in this case not. Had missed the requirement about the mandatory trailing space on the filling. Really can't see the point with an ascii art challenge but if that's what OP requires then I guess my answer is invalid anyway.

                                                                – ElPedro
                                                                Jan 6 at 0:13











                                                              • Now corrected...

                                                                – ElPedro
                                                                Jan 6 at 0:18











                                                              • Why bring it back to 76? Just put +' ' after (l-2). Also, you have a typo, *' ' must be +' '.

                                                                – Erik the Outgolfer
                                                                Jan 6 at 0:23













                                                              • That's what I did with my current solution. Will take a closer look at your hints tomorrow (later today). It's late here and I have been shoveling snow all day so too tired for golf. Thanks for the tips though :)

                                                                – ElPedro
                                                                Jan 6 at 0:27
















                                                              2















                                                              Python 2, 77 76 72 bytes





                                                              lambda i:'n'.join((x*len(i),' '+x*(len(i)-2))[x>'o']for x in i if'e'<x)


                                                              Try it online!



                                                              The outer part of the cookie is 'o' and the filling is 'r'.






                                                              share|improve this answer


























                                                              • 68 bytes. Although I doubt if you can really omit the trailing spaces, the spec does say "The whitespace padding on each side of the filling is required"...

                                                                – Erik the Outgolfer
                                                                Jan 5 at 22:35











                                                              • Thanks @EriktheOutgolfer. Thought a lambda would be shorter! Guess in this case not. Had missed the requirement about the mandatory trailing space on the filling. Really can't see the point with an ascii art challenge but if that's what OP requires then I guess my answer is invalid anyway.

                                                                – ElPedro
                                                                Jan 6 at 0:13











                                                              • Now corrected...

                                                                – ElPedro
                                                                Jan 6 at 0:18











                                                              • Why bring it back to 76? Just put +' ' after (l-2). Also, you have a typo, *' ' must be +' '.

                                                                – Erik the Outgolfer
                                                                Jan 6 at 0:23













                                                              • That's what I did with my current solution. Will take a closer look at your hints tomorrow (later today). It's late here and I have been shoveling snow all day so too tired for golf. Thanks for the tips though :)

                                                                – ElPedro
                                                                Jan 6 at 0:27














                                                              2












                                                              2








                                                              2








                                                              Python 2, 77 76 72 bytes





                                                              lambda i:'n'.join((x*len(i),' '+x*(len(i)-2))[x>'o']for x in i if'e'<x)


                                                              Try it online!



                                                              The outer part of the cookie is 'o' and the filling is 'r'.






                                                              share|improve this answer
















                                                              Python 2, 77 76 72 bytes





                                                              lambda i:'n'.join((x*len(i),' '+x*(len(i)-2))[x>'o']for x in i if'e'<x)


                                                              Try it online!



                                                              The outer part of the cookie is 'o' and the filling is 'r'.







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited Jan 7 at 7:22

























                                                              answered Jan 4 at 9:54









                                                              ElPedroElPedro

                                                              3,4831023




                                                              3,4831023













                                                              • 68 bytes. Although I doubt if you can really omit the trailing spaces, the spec does say "The whitespace padding on each side of the filling is required"...

                                                                – Erik the Outgolfer
                                                                Jan 5 at 22:35











                                                              • Thanks @EriktheOutgolfer. Thought a lambda would be shorter! Guess in this case not. Had missed the requirement about the mandatory trailing space on the filling. Really can't see the point with an ascii art challenge but if that's what OP requires then I guess my answer is invalid anyway.

                                                                – ElPedro
                                                                Jan 6 at 0:13











                                                              • Now corrected...

                                                                – ElPedro
                                                                Jan 6 at 0:18











                                                              • Why bring it back to 76? Just put +' ' after (l-2). Also, you have a typo, *' ' must be +' '.

                                                                – Erik the Outgolfer
                                                                Jan 6 at 0:23













                                                              • That's what I did with my current solution. Will take a closer look at your hints tomorrow (later today). It's late here and I have been shoveling snow all day so too tired for golf. Thanks for the tips though :)

                                                                – ElPedro
                                                                Jan 6 at 0:27



















                                                              • 68 bytes. Although I doubt if you can really omit the trailing spaces, the spec does say "The whitespace padding on each side of the filling is required"...

                                                                – Erik the Outgolfer
                                                                Jan 5 at 22:35











                                                              • Thanks @EriktheOutgolfer. Thought a lambda would be shorter! Guess in this case not. Had missed the requirement about the mandatory trailing space on the filling. Really can't see the point with an ascii art challenge but if that's what OP requires then I guess my answer is invalid anyway.

                                                                – ElPedro
                                                                Jan 6 at 0:13











                                                              • Now corrected...

                                                                – ElPedro
                                                                Jan 6 at 0:18











                                                              • Why bring it back to 76? Just put +' ' after (l-2). Also, you have a typo, *' ' must be +' '.

                                                                – Erik the Outgolfer
                                                                Jan 6 at 0:23













                                                              • That's what I did with my current solution. Will take a closer look at your hints tomorrow (later today). It's late here and I have been shoveling snow all day so too tired for golf. Thanks for the tips though :)

                                                                – ElPedro
                                                                Jan 6 at 0:27

















                                                              68 bytes. Although I doubt if you can really omit the trailing spaces, the spec does say "The whitespace padding on each side of the filling is required"...

                                                              – Erik the Outgolfer
                                                              Jan 5 at 22:35





                                                              68 bytes. Although I doubt if you can really omit the trailing spaces, the spec does say "The whitespace padding on each side of the filling is required"...

                                                              – Erik the Outgolfer
                                                              Jan 5 at 22:35













                                                              Thanks @EriktheOutgolfer. Thought a lambda would be shorter! Guess in this case not. Had missed the requirement about the mandatory trailing space on the filling. Really can't see the point with an ascii art challenge but if that's what OP requires then I guess my answer is invalid anyway.

                                                              – ElPedro
                                                              Jan 6 at 0:13





                                                              Thanks @EriktheOutgolfer. Thought a lambda would be shorter! Guess in this case not. Had missed the requirement about the mandatory trailing space on the filling. Really can't see the point with an ascii art challenge but if that's what OP requires then I guess my answer is invalid anyway.

                                                              – ElPedro
                                                              Jan 6 at 0:13













                                                              Now corrected...

                                                              – ElPedro
                                                              Jan 6 at 0:18





                                                              Now corrected...

                                                              – ElPedro
                                                              Jan 6 at 0:18













                                                              Why bring it back to 76? Just put +' ' after (l-2). Also, you have a typo, *' ' must be +' '.

                                                              – Erik the Outgolfer
                                                              Jan 6 at 0:23







                                                              Why bring it back to 76? Just put +' ' after (l-2). Also, you have a typo, *' ' must be +' '.

                                                              – Erik the Outgolfer
                                                              Jan 6 at 0:23















                                                              That's what I did with my current solution. Will take a closer look at your hints tomorrow (later today). It's late here and I have been shoveling snow all day so too tired for golf. Thanks for the tips though :)

                                                              – ElPedro
                                                              Jan 6 at 0:27





                                                              That's what I did with my current solution. Will take a closer look at your hints tomorrow (later today). It's late here and I have been shoveling snow all day so too tired for golf. Thanks for the tips though :)

                                                              – ElPedro
                                                              Jan 6 at 0:27











                                                              2














                                                              x86-64 machine code (Linux), 97 bytes



                                                              0000000000000000 <oreo_asm>:
                                                              0: 56 push %rsi
                                                              1: 57 push %rdi

                                                              0000000000000002 <len>:
                                                              2: 48 ff c7 inc %rdi
                                                              5: 80 3f 00 cmpb $0x0,(%rdi)
                                                              8: 75 f8 jne 2 <len>
                                                              a: 49 89 fc mov %rdi,%r12
                                                              d: 5f pop %rdi
                                                              e: 49 29 fc sub %rdi,%r12
                                                              11: 4d 31 f6 xor %r14,%r14
                                                              14: eb 18 jmp 2e <outer_loop.skip>

                                                              0000000000000016 <extra>:
                                                              16: 41 c6 01 20 movb $0x20,(%r9)
                                                              1a: c6 03 20 movb $0x20,(%rbx)
                                                              1d: 49 ff ce dec %r14
                                                              20: eb 06 jmp 28 <outer_loop>

                                                              0000000000000022 <newline>:
                                                              22: c6 06 0a movb $0xa,(%rsi)
                                                              25: 48 ff c6 inc %rsi

                                                              0000000000000028 <outer_loop>:
                                                              28: 49 ff c6 inc %r14
                                                              2b: 48 ff c7 inc %rdi

                                                              000000000000002e <outer_loop.skip>:
                                                              2e: 44 8a 07 mov (%rdi),%r8b
                                                              31: 41 80 f8 65 cmp $0x65,%r8b
                                                              35: 74 df je 16 <extra>
                                                              37: 45 84 c0 test %r8b,%r8b
                                                              3a: 74 23 je 5f <done>
                                                              3c: 48 89 f3 mov %rsi,%rbx

                                                              000000000000003f <inner_loop>:
                                                              3f: 44 88 06 mov %r8b,(%rsi)
                                                              42: 49 89 f1 mov %rsi,%r9
                                                              45: 48 ff c6 inc %rsi
                                                              48: 48 31 d2 xor %rdx,%rdx
                                                              4b: 48 89 f0 mov %rsi,%rax
                                                              4e: 48 2b 04 24 sub (%rsp),%rax
                                                              52: 4c 29 f0 sub %r14,%rax
                                                              55: 49 f7 f4 div %r12
                                                              58: 48 85 d2 test %rdx,%rdx
                                                              5b: 74 c5 je 22 <newline>
                                                              5d: eb e0 jmp 3f <inner_loop>

                                                              000000000000005f <done>:
                                                              5f: 5e pop %rsi
                                                              60: c3 retq


                                                              This x86-64 function takes in the pointer to the input string in rsi and builds the output starting at the pointer in rdi (these are the registers used to pass the first two arguments from a C function on Linux). For convenience, I've written a C++ wrapper for this which also does nice input sanitization and prints the output. That code can be located here. This also shows the original nasm syntax assembly I wrote for this function (as well as the non-golfed version I got working first).



                                                              A few things to note is that this code doesn't respect any callee saved registers, which means that the C++ code likely will crash if run for a while after calling this function. On my machine it doesn't, but that's rather surprising. I also don't add a null byte to delimit the output string, and instead the space allocated for the output string is pre-filled with bytes. (If this isn't allowed I can add the null terminator at a cost of 3 bytes).



                                                              The logic for this code is essentially counting the length of the string, then building a line of this length for each 'o' and 'r' characters seen in the input string, and then for any 'e' character seen, replacing the first and last characters on the previous line with space characters.



                                                              I can't find anywhere online to compile and run a mix of C++ and nasm source code, so I might write some small wrapper code for this to prove it works. Otherwise you should be able to compile and run this with the makefile in the link I gave with the command:



                                                              $ make oreo ASM_FILE=oreo_golf.nasm
                                                              $ ./oreo oreoorererereoo --use_asm


                                                              I was able to format the assembly to something acceptable by gcc, so try it online!






                                                              share|improve this answer





















                                                              • 1





                                                                Oh my, now this is an entry!

                                                                – GammaGames
                                                                Jan 8 at 15:09
















                                                              2














                                                              x86-64 machine code (Linux), 97 bytes



                                                              0000000000000000 <oreo_asm>:
                                                              0: 56 push %rsi
                                                              1: 57 push %rdi

                                                              0000000000000002 <len>:
                                                              2: 48 ff c7 inc %rdi
                                                              5: 80 3f 00 cmpb $0x0,(%rdi)
                                                              8: 75 f8 jne 2 <len>
                                                              a: 49 89 fc mov %rdi,%r12
                                                              d: 5f pop %rdi
                                                              e: 49 29 fc sub %rdi,%r12
                                                              11: 4d 31 f6 xor %r14,%r14
                                                              14: eb 18 jmp 2e <outer_loop.skip>

                                                              0000000000000016 <extra>:
                                                              16: 41 c6 01 20 movb $0x20,(%r9)
                                                              1a: c6 03 20 movb $0x20,(%rbx)
                                                              1d: 49 ff ce dec %r14
                                                              20: eb 06 jmp 28 <outer_loop>

                                                              0000000000000022 <newline>:
                                                              22: c6 06 0a movb $0xa,(%rsi)
                                                              25: 48 ff c6 inc %rsi

                                                              0000000000000028 <outer_loop>:
                                                              28: 49 ff c6 inc %r14
                                                              2b: 48 ff c7 inc %rdi

                                                              000000000000002e <outer_loop.skip>:
                                                              2e: 44 8a 07 mov (%rdi),%r8b
                                                              31: 41 80 f8 65 cmp $0x65,%r8b
                                                              35: 74 df je 16 <extra>
                                                              37: 45 84 c0 test %r8b,%r8b
                                                              3a: 74 23 je 5f <done>
                                                              3c: 48 89 f3 mov %rsi,%rbx

                                                              000000000000003f <inner_loop>:
                                                              3f: 44 88 06 mov %r8b,(%rsi)
                                                              42: 49 89 f1 mov %rsi,%r9
                                                              45: 48 ff c6 inc %rsi
                                                              48: 48 31 d2 xor %rdx,%rdx
                                                              4b: 48 89 f0 mov %rsi,%rax
                                                              4e: 48 2b 04 24 sub (%rsp),%rax
                                                              52: 4c 29 f0 sub %r14,%rax
                                                              55: 49 f7 f4 div %r12
                                                              58: 48 85 d2 test %rdx,%rdx
                                                              5b: 74 c5 je 22 <newline>
                                                              5d: eb e0 jmp 3f <inner_loop>

                                                              000000000000005f <done>:
                                                              5f: 5e pop %rsi
                                                              60: c3 retq


                                                              This x86-64 function takes in the pointer to the input string in rsi and builds the output starting at the pointer in rdi (these are the registers used to pass the first two arguments from a C function on Linux). For convenience, I've written a C++ wrapper for this which also does nice input sanitization and prints the output. That code can be located here. This also shows the original nasm syntax assembly I wrote for this function (as well as the non-golfed version I got working first).



                                                              A few things to note is that this code doesn't respect any callee saved registers, which means that the C++ code likely will crash if run for a while after calling this function. On my machine it doesn't, but that's rather surprising. I also don't add a null byte to delimit the output string, and instead the space allocated for the output string is pre-filled with bytes. (If this isn't allowed I can add the null terminator at a cost of 3 bytes).



                                                              The logic for this code is essentially counting the length of the string, then building a line of this length for each 'o' and 'r' characters seen in the input string, and then for any 'e' character seen, replacing the first and last characters on the previous line with space characters.



                                                              I can't find anywhere online to compile and run a mix of C++ and nasm source code, so I might write some small wrapper code for this to prove it works. Otherwise you should be able to compile and run this with the makefile in the link I gave with the command:



                                                              $ make oreo ASM_FILE=oreo_golf.nasm
                                                              $ ./oreo oreoorererereoo --use_asm


                                                              I was able to format the assembly to something acceptable by gcc, so try it online!






                                                              share|improve this answer





















                                                              • 1





                                                                Oh my, now this is an entry!

                                                                – GammaGames
                                                                Jan 8 at 15:09














                                                              2












                                                              2








                                                              2







                                                              x86-64 machine code (Linux), 97 bytes



                                                              0000000000000000 <oreo_asm>:
                                                              0: 56 push %rsi
                                                              1: 57 push %rdi

                                                              0000000000000002 <len>:
                                                              2: 48 ff c7 inc %rdi
                                                              5: 80 3f 00 cmpb $0x0,(%rdi)
                                                              8: 75 f8 jne 2 <len>
                                                              a: 49 89 fc mov %rdi,%r12
                                                              d: 5f pop %rdi
                                                              e: 49 29 fc sub %rdi,%r12
                                                              11: 4d 31 f6 xor %r14,%r14
                                                              14: eb 18 jmp 2e <outer_loop.skip>

                                                              0000000000000016 <extra>:
                                                              16: 41 c6 01 20 movb $0x20,(%r9)
                                                              1a: c6 03 20 movb $0x20,(%rbx)
                                                              1d: 49 ff ce dec %r14
                                                              20: eb 06 jmp 28 <outer_loop>

                                                              0000000000000022 <newline>:
                                                              22: c6 06 0a movb $0xa,(%rsi)
                                                              25: 48 ff c6 inc %rsi

                                                              0000000000000028 <outer_loop>:
                                                              28: 49 ff c6 inc %r14
                                                              2b: 48 ff c7 inc %rdi

                                                              000000000000002e <outer_loop.skip>:
                                                              2e: 44 8a 07 mov (%rdi),%r8b
                                                              31: 41 80 f8 65 cmp $0x65,%r8b
                                                              35: 74 df je 16 <extra>
                                                              37: 45 84 c0 test %r8b,%r8b
                                                              3a: 74 23 je 5f <done>
                                                              3c: 48 89 f3 mov %rsi,%rbx

                                                              000000000000003f <inner_loop>:
                                                              3f: 44 88 06 mov %r8b,(%rsi)
                                                              42: 49 89 f1 mov %rsi,%r9
                                                              45: 48 ff c6 inc %rsi
                                                              48: 48 31 d2 xor %rdx,%rdx
                                                              4b: 48 89 f0 mov %rsi,%rax
                                                              4e: 48 2b 04 24 sub (%rsp),%rax
                                                              52: 4c 29 f0 sub %r14,%rax
                                                              55: 49 f7 f4 div %r12
                                                              58: 48 85 d2 test %rdx,%rdx
                                                              5b: 74 c5 je 22 <newline>
                                                              5d: eb e0 jmp 3f <inner_loop>

                                                              000000000000005f <done>:
                                                              5f: 5e pop %rsi
                                                              60: c3 retq


                                                              This x86-64 function takes in the pointer to the input string in rsi and builds the output starting at the pointer in rdi (these are the registers used to pass the first two arguments from a C function on Linux). For convenience, I've written a C++ wrapper for this which also does nice input sanitization and prints the output. That code can be located here. This also shows the original nasm syntax assembly I wrote for this function (as well as the non-golfed version I got working first).



                                                              A few things to note is that this code doesn't respect any callee saved registers, which means that the C++ code likely will crash if run for a while after calling this function. On my machine it doesn't, but that's rather surprising. I also don't add a null byte to delimit the output string, and instead the space allocated for the output string is pre-filled with bytes. (If this isn't allowed I can add the null terminator at a cost of 3 bytes).



                                                              The logic for this code is essentially counting the length of the string, then building a line of this length for each 'o' and 'r' characters seen in the input string, and then for any 'e' character seen, replacing the first and last characters on the previous line with space characters.



                                                              I can't find anywhere online to compile and run a mix of C++ and nasm source code, so I might write some small wrapper code for this to prove it works. Otherwise you should be able to compile and run this with the makefile in the link I gave with the command:



                                                              $ make oreo ASM_FILE=oreo_golf.nasm
                                                              $ ./oreo oreoorererereoo --use_asm


                                                              I was able to format the assembly to something acceptable by gcc, so try it online!






                                                              share|improve this answer















                                                              x86-64 machine code (Linux), 97 bytes



                                                              0000000000000000 <oreo_asm>:
                                                              0: 56 push %rsi
                                                              1: 57 push %rdi

                                                              0000000000000002 <len>:
                                                              2: 48 ff c7 inc %rdi
                                                              5: 80 3f 00 cmpb $0x0,(%rdi)
                                                              8: 75 f8 jne 2 <len>
                                                              a: 49 89 fc mov %rdi,%r12
                                                              d: 5f pop %rdi
                                                              e: 49 29 fc sub %rdi,%r12
                                                              11: 4d 31 f6 xor %r14,%r14
                                                              14: eb 18 jmp 2e <outer_loop.skip>

                                                              0000000000000016 <extra>:
                                                              16: 41 c6 01 20 movb $0x20,(%r9)
                                                              1a: c6 03 20 movb $0x20,(%rbx)
                                                              1d: 49 ff ce dec %r14
                                                              20: eb 06 jmp 28 <outer_loop>

                                                              0000000000000022 <newline>:
                                                              22: c6 06 0a movb $0xa,(%rsi)
                                                              25: 48 ff c6 inc %rsi

                                                              0000000000000028 <outer_loop>:
                                                              28: 49 ff c6 inc %r14
                                                              2b: 48 ff c7 inc %rdi

                                                              000000000000002e <outer_loop.skip>:
                                                              2e: 44 8a 07 mov (%rdi),%r8b
                                                              31: 41 80 f8 65 cmp $0x65,%r8b
                                                              35: 74 df je 16 <extra>
                                                              37: 45 84 c0 test %r8b,%r8b
                                                              3a: 74 23 je 5f <done>
                                                              3c: 48 89 f3 mov %rsi,%rbx

                                                              000000000000003f <inner_loop>:
                                                              3f: 44 88 06 mov %r8b,(%rsi)
                                                              42: 49 89 f1 mov %rsi,%r9
                                                              45: 48 ff c6 inc %rsi
                                                              48: 48 31 d2 xor %rdx,%rdx
                                                              4b: 48 89 f0 mov %rsi,%rax
                                                              4e: 48 2b 04 24 sub (%rsp),%rax
                                                              52: 4c 29 f0 sub %r14,%rax
                                                              55: 49 f7 f4 div %r12
                                                              58: 48 85 d2 test %rdx,%rdx
                                                              5b: 74 c5 je 22 <newline>
                                                              5d: eb e0 jmp 3f <inner_loop>

                                                              000000000000005f <done>:
                                                              5f: 5e pop %rsi
                                                              60: c3 retq


                                                              This x86-64 function takes in the pointer to the input string in rsi and builds the output starting at the pointer in rdi (these are the registers used to pass the first two arguments from a C function on Linux). For convenience, I've written a C++ wrapper for this which also does nice input sanitization and prints the output. That code can be located here. This also shows the original nasm syntax assembly I wrote for this function (as well as the non-golfed version I got working first).



                                                              A few things to note is that this code doesn't respect any callee saved registers, which means that the C++ code likely will crash if run for a while after calling this function. On my machine it doesn't, but that's rather surprising. I also don't add a null byte to delimit the output string, and instead the space allocated for the output string is pre-filled with bytes. (If this isn't allowed I can add the null terminator at a cost of 3 bytes).



                                                              The logic for this code is essentially counting the length of the string, then building a line of this length for each 'o' and 'r' characters seen in the input string, and then for any 'e' character seen, replacing the first and last characters on the previous line with space characters.



                                                              I can't find anywhere online to compile and run a mix of C++ and nasm source code, so I might write some small wrapper code for this to prove it works. Otherwise you should be able to compile and run this with the makefile in the link I gave with the command:



                                                              $ make oreo ASM_FILE=oreo_golf.nasm
                                                              $ ./oreo oreoorererereoo --use_asm


                                                              I was able to format the assembly to something acceptable by gcc, so try it online!







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited Jan 8 at 9:07

























                                                              answered Jan 7 at 6:51









                                                              daveydavey

                                                              29117




                                                              29117








                                                              • 1





                                                                Oh my, now this is an entry!

                                                                – GammaGames
                                                                Jan 8 at 15:09














                                                              • 1





                                                                Oh my, now this is an entry!

                                                                – GammaGames
                                                                Jan 8 at 15:09








                                                              1




                                                              1





                                                              Oh my, now this is an entry!

                                                              – GammaGames
                                                              Jan 8 at 15:09





                                                              Oh my, now this is an entry!

                                                              – GammaGames
                                                              Jan 8 at 15:09











                                                              2















                                                              Pyth, 28 bytes



                                                              FNzIqN"o"*lzN)IqN"r"+d*-lz2N
                                                              FNz For each value, N, in input
                                                              IqN"o" if the character is "o"
                                                              *lzN return the character times the length of the input
                                                              ) end if
                                                              IqN"r" if the character is "r"
                                                              FNzIqN"o"*lzN)IqN"r"+d*-lz2N
                                                              *-lz2N return the character times length - 2
                                                              +d padded on the left with " "


                                                              Try it here! This one uses a loop.



                                                              Pyth, 30 bytes



                                                              (As string replace)



                                                              ::z"o"+*lz"="b"re"++d*-lz2"~"b
                                                              :z"o" With the input, replace "o" with
                                                              *lz"=" "=" times the length of the input
                                                              + b and a newline added to the end
                                                              : "re" With the input, replace "re" with
                                                              * "~" "~" times
                                                              -lz2 the length of the input minus 2
                                                              +d padded on the left with " "
                                                              + b and a newline added to the end


                                                              Try it here! This one uses string replacement.



                                                              I really like python (it's what I wrote my original test scripts in), so I thought I'd do a pyth entry for fun :)






                                                              share|improve this answer





















                                                              • 1





                                                                Isn't this 37 bytes? I thought Pyth uses default ASCII as its codepage just like Python, if I remember correctly. So even though your code is 33 characters, both and are three bytes each. Or am I missing something here?

                                                                – Kevin Cruijssen
                                                                Jan 4 at 7:05











                                                              • Good call, I didn't realize that (I couldn't get pyth to work on tio.run, so I used the length counter on the herokuapp page). In the for loop I could just replace the character with N, even saving a few bytes!

                                                                – GammaGames
                                                                Jan 4 at 14:38











                                                              • Thought something like that happened. :) I once had the same issue with a 05AB1E answer of mine that was using characters outside its code page. Unfortunately TIO displays chars and bytes the same for most golfing languages. For Java or Python TIO will correctly state 33 chars, 37 bytes, but not in golfing languages on TIO. But in your solutions just changing those characters indeed fixes the issue, so it's not that big of a deal here.

                                                                – Kevin Cruijssen
                                                                Jan 4 at 14:41













                                                              • @KevinCruijssen Wait, 05AB1E doesn't use an actual SBCS?

                                                                – ASCII-only
                                                                Jan 6 at 1:08






                                                              • 1





                                                                If you're interested, it seems to work effortlessly on TIO for me.

                                                                – NieDzejkob
                                                                2 days ago
















                                                              2















                                                              Pyth, 28 bytes



                                                              FNzIqN"o"*lzN)IqN"r"+d*-lz2N
                                                              FNz For each value, N, in input
                                                              IqN"o" if the character is "o"
                                                              *lzN return the character times the length of the input
                                                              ) end if
                                                              IqN"r" if the character is "r"
                                                              FNzIqN"o"*lzN)IqN"r"+d*-lz2N
                                                              *-lz2N return the character times length - 2
                                                              +d padded on the left with " "


                                                              Try it here! This one uses a loop.



                                                              Pyth, 30 bytes



                                                              (As string replace)



                                                              ::z"o"+*lz"="b"re"++d*-lz2"~"b
                                                              :z"o" With the input, replace "o" with
                                                              *lz"=" "=" times the length of the input
                                                              + b and a newline added to the end
                                                              : "re" With the input, replace "re" with
                                                              * "~" "~" times
                                                              -lz2 the length of the input minus 2
                                                              +d padded on the left with " "
                                                              + b and a newline added to the end


                                                              Try it here! This one uses string replacement.



                                                              I really like python (it's what I wrote my original test scripts in), so I thought I'd do a pyth entry for fun :)






                                                              share|improve this answer





















                                                              • 1





                                                                Isn't this 37 bytes? I thought Pyth uses default ASCII as its codepage just like Python, if I remember correctly. So even though your code is 33 characters, both and are three bytes each. Or am I missing something here?

                                                                – Kevin Cruijssen
                                                                Jan 4 at 7:05











                                                              • Good call, I didn't realize that (I couldn't get pyth to work on tio.run, so I used the length counter on the herokuapp page). In the for loop I could just replace the character with N, even saving a few bytes!

                                                                – GammaGames
                                                                Jan 4 at 14:38











                                                              • Thought something like that happened. :) I once had the same issue with a 05AB1E answer of mine that was using characters outside its code page. Unfortunately TIO displays chars and bytes the same for most golfing languages. For Java or Python TIO will correctly state 33 chars, 37 bytes, but not in golfing languages on TIO. But in your solutions just changing those characters indeed fixes the issue, so it's not that big of a deal here.

                                                                – Kevin Cruijssen
                                                                Jan 4 at 14:41













                                                              • @KevinCruijssen Wait, 05AB1E doesn't use an actual SBCS?

                                                                – ASCII-only
                                                                Jan 6 at 1:08






                                                              • 1





                                                                If you're interested, it seems to work effortlessly on TIO for me.

                                                                – NieDzejkob
                                                                2 days ago














                                                              2












                                                              2








                                                              2








                                                              Pyth, 28 bytes



                                                              FNzIqN"o"*lzN)IqN"r"+d*-lz2N
                                                              FNz For each value, N, in input
                                                              IqN"o" if the character is "o"
                                                              *lzN return the character times the length of the input
                                                              ) end if
                                                              IqN"r" if the character is "r"
                                                              FNzIqN"o"*lzN)IqN"r"+d*-lz2N
                                                              *-lz2N return the character times length - 2
                                                              +d padded on the left with " "


                                                              Try it here! This one uses a loop.



                                                              Pyth, 30 bytes



                                                              (As string replace)



                                                              ::z"o"+*lz"="b"re"++d*-lz2"~"b
                                                              :z"o" With the input, replace "o" with
                                                              *lz"=" "=" times the length of the input
                                                              + b and a newline added to the end
                                                              : "re" With the input, replace "re" with
                                                              * "~" "~" times
                                                              -lz2 the length of the input minus 2
                                                              +d padded on the left with " "
                                                              + b and a newline added to the end


                                                              Try it here! This one uses string replacement.



                                                              I really like python (it's what I wrote my original test scripts in), so I thought I'd do a pyth entry for fun :)






                                                              share|improve this answer
















                                                              Pyth, 28 bytes



                                                              FNzIqN"o"*lzN)IqN"r"+d*-lz2N
                                                              FNz For each value, N, in input
                                                              IqN"o" if the character is "o"
                                                              *lzN return the character times the length of the input
                                                              ) end if
                                                              IqN"r" if the character is "r"
                                                              FNzIqN"o"*lzN)IqN"r"+d*-lz2N
                                                              *-lz2N return the character times length - 2
                                                              +d padded on the left with " "


                                                              Try it here! This one uses a loop.



                                                              Pyth, 30 bytes



                                                              (As string replace)



                                                              ::z"o"+*lz"="b"re"++d*-lz2"~"b
                                                              :z"o" With the input, replace "o" with
                                                              *lz"=" "=" times the length of the input
                                                              + b and a newline added to the end
                                                              : "re" With the input, replace "re" with
                                                              * "~" "~" times
                                                              -lz2 the length of the input minus 2
                                                              +d padded on the left with " "
                                                              + b and a newline added to the end


                                                              Try it here! This one uses string replacement.



                                                              I really like python (it's what I wrote my original test scripts in), so I thought I'd do a pyth entry for fun :)







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited 2 days ago

























                                                              answered Jan 4 at 5:45









                                                              GammaGamesGammaGames

                                                              592211




                                                              592211








                                                              • 1





                                                                Isn't this 37 bytes? I thought Pyth uses default ASCII as its codepage just like Python, if I remember correctly. So even though your code is 33 characters, both and are three bytes each. Or am I missing something here?

                                                                – Kevin Cruijssen
                                                                Jan 4 at 7:05











                                                              • Good call, I didn't realize that (I couldn't get pyth to work on tio.run, so I used the length counter on the herokuapp page). In the for loop I could just replace the character with N, even saving a few bytes!

                                                                – GammaGames
                                                                Jan 4 at 14:38











                                                              • Thought something like that happened. :) I once had the same issue with a 05AB1E answer of mine that was using characters outside its code page. Unfortunately TIO displays chars and bytes the same for most golfing languages. For Java or Python TIO will correctly state 33 chars, 37 bytes, but not in golfing languages on TIO. But in your solutions just changing those characters indeed fixes the issue, so it's not that big of a deal here.

                                                                – Kevin Cruijssen
                                                                Jan 4 at 14:41













                                                              • @KevinCruijssen Wait, 05AB1E doesn't use an actual SBCS?

                                                                – ASCII-only
                                                                Jan 6 at 1:08






                                                              • 1





                                                                If you're interested, it seems to work effortlessly on TIO for me.

                                                                – NieDzejkob
                                                                2 days ago














                                                              • 1





                                                                Isn't this 37 bytes? I thought Pyth uses default ASCII as its codepage just like Python, if I remember correctly. So even though your code is 33 characters, both and are three bytes each. Or am I missing something here?

                                                                – Kevin Cruijssen
                                                                Jan 4 at 7:05











                                                              • Good call, I didn't realize that (I couldn't get pyth to work on tio.run, so I used the length counter on the herokuapp page). In the for loop I could just replace the character with N, even saving a few bytes!

                                                                – GammaGames
                                                                Jan 4 at 14:38











                                                              • Thought something like that happened. :) I once had the same issue with a 05AB1E answer of mine that was using characters outside its code page. Unfortunately TIO displays chars and bytes the same for most golfing languages. For Java or Python TIO will correctly state 33 chars, 37 bytes, but not in golfing languages on TIO. But in your solutions just changing those characters indeed fixes the issue, so it's not that big of a deal here.

                                                                – Kevin Cruijssen
                                                                Jan 4 at 14:41













                                                              • @KevinCruijssen Wait, 05AB1E doesn't use an actual SBCS?

                                                                – ASCII-only
                                                                Jan 6 at 1:08






                                                              • 1





                                                                If you're interested, it seems to work effortlessly on TIO for me.

                                                                – NieDzejkob
                                                                2 days ago








                                                              1




                                                              1





                                                              Isn't this 37 bytes? I thought Pyth uses default ASCII as its codepage just like Python, if I remember correctly. So even though your code is 33 characters, both and are three bytes each. Or am I missing something here?

                                                              – Kevin Cruijssen
                                                              Jan 4 at 7:05





                                                              Isn't this 37 bytes? I thought Pyth uses default ASCII as its codepage just like Python, if I remember correctly. So even though your code is 33 characters, both and are three bytes each. Or am I missing something here?

                                                              – Kevin Cruijssen
                                                              Jan 4 at 7:05













                                                              Good call, I didn't realize that (I couldn't get pyth to work on tio.run, so I used the length counter on the herokuapp page). In the for loop I could just replace the character with N, even saving a few bytes!

                                                              – GammaGames
                                                              Jan 4 at 14:38





                                                              Good call, I didn't realize that (I couldn't get pyth to work on tio.run, so I used the length counter on the herokuapp page). In the for loop I could just replace the character with N, even saving a few bytes!

                                                              – GammaGames
                                                              Jan 4 at 14:38













                                                              Thought something like that happened. :) I once had the same issue with a 05AB1E answer of mine that was using characters outside its code page. Unfortunately TIO displays chars and bytes the same for most golfing languages. For Java or Python TIO will correctly state 33 chars, 37 bytes, but not in golfing languages on TIO. But in your solutions just changing those characters indeed fixes the issue, so it's not that big of a deal here.

                                                              – Kevin Cruijssen
                                                              Jan 4 at 14:41







                                                              Thought something like that happened. :) I once had the same issue with a 05AB1E answer of mine that was using characters outside its code page. Unfortunately TIO displays chars and bytes the same for most golfing languages. For Java or Python TIO will correctly state 33 chars, 37 bytes, but not in golfing languages on TIO. But in your solutions just changing those characters indeed fixes the issue, so it's not that big of a deal here.

                                                              – Kevin Cruijssen
                                                              Jan 4 at 14:41















                                                              @KevinCruijssen Wait, 05AB1E doesn't use an actual SBCS?

                                                              – ASCII-only
                                                              Jan 6 at 1:08





                                                              @KevinCruijssen Wait, 05AB1E doesn't use an actual SBCS?

                                                              – ASCII-only
                                                              Jan 6 at 1:08




                                                              1




                                                              1





                                                              If you're interested, it seems to work effortlessly on TIO for me.

                                                              – NieDzejkob
                                                              2 days ago





                                                              If you're interested, it seems to work effortlessly on TIO for me.

                                                              – NieDzejkob
                                                              2 days ago











                                                              2















                                                              Ruby, 62 60 bytes





                                                              ->s{s.gsub /./,?r=>" #{(?**z=s.size)[0..-3]}
                                                              ",?o=>?O*z+?n}


                                                              Try it online!



                                                              Uses O for the cookie, * for the filling.



                                                              -1 thanks to @manatwork pointing out a silly mistake and another -1 due to relaxation of the rules about whitespaces.






                                                              share|improve this answer


























                                                              • No need for parenthesis around .gsub's parameters.

                                                                – manatwork
                                                                2 days ago
















                                                              2















                                                              Ruby, 62 60 bytes





                                                              ->s{s.gsub /./,?r=>" #{(?**z=s.size)[0..-3]}
                                                              ",?o=>?O*z+?n}


                                                              Try it online!



                                                              Uses O for the cookie, * for the filling.



                                                              -1 thanks to @manatwork pointing out a silly mistake and another -1 due to relaxation of the rules about whitespaces.






                                                              share|improve this answer


























                                                              • No need for parenthesis around .gsub's parameters.

                                                                – manatwork
                                                                2 days ago














                                                              2












                                                              2








                                                              2








                                                              Ruby, 62 60 bytes





                                                              ->s{s.gsub /./,?r=>" #{(?**z=s.size)[0..-3]}
                                                              ",?o=>?O*z+?n}


                                                              Try it online!



                                                              Uses O for the cookie, * for the filling.



                                                              -1 thanks to @manatwork pointing out a silly mistake and another -1 due to relaxation of the rules about whitespaces.






                                                              share|improve this answer
















                                                              Ruby, 62 60 bytes





                                                              ->s{s.gsub /./,?r=>" #{(?**z=s.size)[0..-3]}
                                                              ",?o=>?O*z+?n}


                                                              Try it online!



                                                              Uses O for the cookie, * for the filling.



                                                              -1 thanks to @manatwork pointing out a silly mistake and another -1 due to relaxation of the rules about whitespaces.







                                                              share|improve this answer














                                                              share|improve this answer



                                                              share|improve this answer








                                                              edited yesterday

























                                                              answered Jan 7 at 10:48









                                                              Kirill L.Kirill L.

                                                              3,6951319




                                                              3,6951319













                                                              • No need for parenthesis around .gsub's parameters.

                                                                – manatwork
                                                                2 days ago



















                                                              • No need for parenthesis around .gsub's parameters.

                                                                – manatwork
                                                                2 days ago

















                                                              No need for parenthesis around .gsub's parameters.

                                                              – manatwork
                                                              2 days ago





                                                              No need for parenthesis around .gsub's parameters.

                                                              – manatwork
                                                              2 days ago










                                                              1 2
                                                              next

















                                                              draft saved

                                                              draft discarded




















































                                                              If this is an answer to a challenge…




                                                              • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                              • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                Explanations of your answer make it more interesting to read and are very much encouraged.


                                                              • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                              More generally…




                                                              • …Please make sure to answer the question and provide sufficient detail.


                                                              • …Avoid asking for help, clarification or responding to other answers (use comments instead).





                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function () {
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f178344%2foreoorererereoo%23new-answer', 'question_page');
                                                              }
                                                              );

                                                              Post as a guest















                                                              Required, but never shown





















































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown

































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown







                                                              Popular posts from this blog

                                                              Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

                                                              ComboBox Display Member on multiple fields

                                                              Is it possible to collect Nectar points via Trainline?