65
\$\begingroup\$

Challenge description

On some channels on a popular streaming site twitch.tv a common message people tend to spam in chats to bait people into spamming "LUL" is

One more LUL and I'm out

LUL is a popular emote used to express that something funny happened on stream.

Soon dank memes showed their potential and a parody of the copy-pasta ensued:

One more "One more LUL and I'm out" and I'm out

Which is the same message nested in itself. Given a non-negative integer N, output the LUL-pasta nested N times in itself following the pattern below.

Standard rules apply, the shortest code in bytes wins.

Sample input / output

0: One more LUL and I'm out
1: One more "One more LUL and I'm out" and I'm out
2: One more "One more "One more LUL and I'm out" and I'm out" and I'm out
...
7: One more "One more "One more "One more "One more "One more "One more "One more LUL and I'm out" and I'm out" and I'm out" and I'm out" and I'm out" and I'm out" and I'm out" and I'm out

Notes

  • Leading/trailing newlines are allowed
  • Capitalization must be preserved
  • Your code may be a full program or a function
  • Instead of printing, you may return a string or its equivalent in your language of choice
  • You may index from 1 instead of 0
\$\endgroup\$
11
  • 6
    \$\begingroup\$ can I add " in the start and end too? \$\endgroup\$
    – Rod
    Commented Jan 19, 2017 at 11:44
  • 8
    \$\begingroup\$ @Rod: No, you cannot. \$\endgroup\$
    – shooqie
    Commented Jan 19, 2017 at 12:07
  • 30
    \$\begingroup\$ The title of this challenge is very awkward for Dutch speakers... \$\endgroup\$
    – user34409
    Commented Jan 19, 2017 at 14:12
  • 6
    \$\begingroup\$ @Pakk But it's true. I see a LUL, and I'm outta here... \$\endgroup\$
    – steenbergh
    Commented Jan 19, 2017 at 14:20
  • 8
    \$\begingroup\$ This can be extended to YOLO: You Only YOLO once --> YOYOLOO. You Only YOYOLOO Once --> YOYOYOLOOO, etc. \$\endgroup\$
    – DJMcMayhem
    Commented Jan 19, 2017 at 16:07

66 Answers 66

29
\$\begingroup\$

Python 2, 56 bytes

lambda x:('"One more '*x+'LUL'+' and I\'m out"'*x)[1:-1]

Try it online!
It is 1-indexed

\$\endgroup\$
4
  • 4
    \$\begingroup\$ I assume the [1:-1] at the end trims the double quotes at the start and end? \$\endgroup\$
    – Nzall
    Commented Jan 19, 2017 at 13:13
  • \$\begingroup\$ @Nzall Precisely \$\endgroup\$
    – Rod
    Commented Jan 19, 2017 at 13:15
  • \$\begingroup\$ For x=0 this gives 'U', but should give "One more LUL and I'm out". \$\endgroup\$
    – Wolfram
    Commented Jan 19, 2017 at 14:30
  • 4
    \$\begingroup\$ @Wolfram It is 1-indexed, added this info to the answer \$\endgroup\$
    – Rod
    Commented Jan 19, 2017 at 14:36
20
\$\begingroup\$

JavaScript, 57 56 54 52 bytes

f=q=>`One more ${q?`"${f(q-1)}"`:"LUL"} and I'm out`

Test Snippet:

f=q=>`One more ${q?`"${f(q-1)}"`:"LUL"} and I'm out`
<input type=number min=0 oninput=o.textContent=f(+this.value)>

<p id=o>

For some reason the snack snippet is being buggy when the input is 0, but this works otherwise. Call it like f(4).

Explanation

f=q=>                      //declares a function f with argument q
`One more ... and I'm out` //hardcoded string
 ${q?`"${f(q-1)}"`:"LUL"}  // does recursion based on q
                           // if q is true, ie not 0, recurse
                           // else return "LUL"
\$\endgroup\$
6
  • \$\begingroup\$ First off input is an invalid HTML attribute, might wanna remove that. Secondly, it's because it takes the input as a string, not a number. So "0" is truthy while 0 is falsy. Easiest way to handle that is to put a + in front of this.value when you're passing it. \$\endgroup\$ Commented Jan 19, 2017 at 14:58
  • \$\begingroup\$ @PatrickRoberts Thanks, I don't know why I have an extra input field :) \$\endgroup\$
    – user41805
    Commented Jan 19, 2017 at 15:01
  • \$\begingroup\$ Nice, I probably would've tried using .replace. \$\endgroup\$ Commented Jan 19, 2017 at 16:49
  • \$\begingroup\$ Stack overflows when number is negative. \$\endgroup\$
    – user58826
    Commented Apr 6, 2017 at 12:10
  • \$\begingroup\$ @programmer500 The input number is given to be non-negative so that is not a problem \$\endgroup\$
    – user41805
    Commented Apr 6, 2017 at 14:37
11
\$\begingroup\$

Befunge, 91 bytes

&:00p10p>"tuo m'I dna "1v
09p00-1<^g09p01-1_v#:g0<<vg
>>00g:#^_$>:#,_@  >$"LUL">" erom enO"

Try it online!

This is a breakdown of the source code with the various component parts highlighted.

Source code with execution paths highlighted

* We start by reading the repeat count N, and storing two duplicates of it in memory.
* We then countdown the first N, pushing multiple copies of " and I'm out" onto the stack in reverse. Each additional copy is separated from the one before with a quote. The quote is generated with the sequence 90g (basically reading a copy from the first line of the source), since that's the shortest way to do so.
* Once this first loop is complete, we push "LUL" onto the stack (technically this is in reverse, but it obviously makes no difference when it's a palindrome).
* Then we have another loop, wrapping across the right border, over to the left of playfield, and then back again. This time we're counting down the second N, pushing multiple copies of "One more " onto the stack (again in reverse). And again, each additional copy is separated from the one before with a quote.
* Once the second loop is complete, the entire phrase is now on the stack (in reverse), so we simply need to write it out.

\$\endgroup\$
1
  • \$\begingroup\$ Nice use of get to push a ". Thanks for the explanation \$\endgroup\$ Commented Jan 19, 2017 at 21:07
6
\$\begingroup\$

05AB1E, 30 29 bytes

…LULIF“"One€£ ÿ€ƒ I'm€Ä"“}}¦¨

Try it online!

Different string-types doesn't seem to mix well, so for some reason I need to end the loop twice.

\$\endgroup\$
6
\$\begingroup\$

C++, 118 + 16 = 134 bytes

auto L(int x){std::string k="One more LUL and I'm out",r=k;for(int i=0;i++<x;)r.replace(i*10-1,3,'"'+k+'"');return r;}

#include<string> - +16

replaces "LUL" to the whole string N times.

Anyone has better golfs?

Try it online!

Massive thanks to Kritixi Lithos and hvd, for, uh, Massive help.

\$\endgroup\$
15
  • \$\begingroup\$ @Kritixi Now it has a snippet. \$\endgroup\$ Commented Jan 19, 2017 at 12:42
  • \$\begingroup\$ This is shorter. And I think you might need to include the <string> import statement into the bytecount, not sure \$\endgroup\$
    – user41805
    Commented Jan 19, 2017 at 12:47
  • \$\begingroup\$ Also you can change the for(int i=0;i<x;i++) to for(int i=0;i++<x;) \$\endgroup\$
    – user41805
    Commented Jan 19, 2017 at 12:50
  • \$\begingroup\$ Additionally, r.find("L") is shorter than r.find("LOL") by 2 bytes :) \$\endgroup\$
    – user41805
    Commented Jan 19, 2017 at 12:57
  • \$\begingroup\$ Recursive version: Try it online! Also you can use the header and footer on TIO for additional stuff, and then only count your code in the byte count. \$\endgroup\$
    – nmjcman101
    Commented Jan 19, 2017 at 18:35
5
\$\begingroup\$

Javascript (ES6), 68 Bytes

f=(x,y="LUL")=>~x?f(--x,`"One more ${y} and I'm out"`):y.slice(1,-1)

Call like f(n).

You can also call it like f(n, "LUL") and replace LUL with any word you wish.

\$\endgroup\$
2
  • \$\begingroup\$ Since the question asks for just "LUL", you could probably eliminate the flexibility of changing the text and golf out some bytes. Nice solution anyway, +1 \$\endgroup\$ Commented Jan 22, 2017 at 8:20
  • 2
    \$\begingroup\$ @FarhanAnam I thought this was a good starting post that I would then edit, but after I posted I saw someone had posted a better answer and no matter how hard I tried to golf it I always ended up on their answer. So I thought I should just leave it here with the flexibility so that someone has some fun with it. \$\endgroup\$
    – user64039
    Commented Jan 23, 2017 at 9:43
5
\$\begingroup\$

V, 39 37 bytes

Two bytes with the help of @KritixiLithos for coming up with the substitution method

iOne more LUL and I'm outÀñÓLUL/"."

Try it online!

Hexdump:

00000000: 694f 6e65 206d 6f72 6520 4c55 4c20 616e  iOne more LUL an
00000010: 6420 4927 6d20 6f75 741b c0f1 d34c 554c  d I'm out....LUL
00000020: 2f22 122e 22                             /".."
\$\endgroup\$
1
  • \$\begingroup\$ It is LUL and not LOL ;) \$\endgroup\$ Commented Jan 19, 2017 at 15:31
4
\$\begingroup\$

Java, 79 77 bytes

Golfed:

String f(int l){return"One more "+(l<1?"LUL":'"'+f(l-1)+'"')+" and I'm out";}

Ungolfed, with test:

public class OneMoreLulAndImOut {

  public static void main(String[] args) {
    OneMoreLulAndImOut obj = new OneMoreLulAndImOut();
    for (int i = 0; i < 8; ++i) {
      System.out.println(Integer.toString(i) + ": " + obj.f(i));
    }
  }

  String f(int l) {
    return "One more " + (l < 1 ? "LUL" : '"' + f(l - 1) + '"') + " and I'm out";
  }    
}

Program output:

0: One more LUL and I'm out
1: One more "One more LUL and I'm out" and I'm out
2: One more "One more "One more LUL and I'm out" and I'm out" and I'm out
3: One more "One more "One more "One more LUL and I'm out" and I'm out" and I'm out" and I'm out
4: One more "One more "One more "One more "One more LUL and I'm out" and I'm out" and I'm out" and I'm out" and I'm out
5: One more "One more "One more "One more "One more "One more LUL and I'm out" and I'm out" and I'm out" and I'm out" and I'm out" and I'm out
6: One more "One more "One more "One more "One more "One more "One more LUL and I'm out" and I'm out" and I'm out" and I'm out" and I'm out" and I'm out" and I'm out
7: One more "One more "One more "One more "One more "One more "One more "One more LUL and I'm out" and I'm out" and I'm out" and I'm out" and I'm out" and I'm out" and I'm out" and I'm out
\$\endgroup\$
2
  • \$\begingroup\$ You can change both "\"" to '"' (single chars) to save 2 bytes. \$\endgroup\$ Commented Jan 20, 2017 at 8:04
  • 1
    \$\begingroup\$ @KevinCruijssen thanks, I knew there was something I missed. \$\endgroup\$
    – user18932
    Commented Jan 20, 2017 at 15:26
3
\$\begingroup\$

Python, 79 bytes

I just wanted to do a recursive solution, even though it's longer than other answers.

x='"One more %s and I\'m out"'
f=lambda n,s=x:n and f(n-1,s%x)or(s%"LUL")[1:-1]

Try it online

\$\endgroup\$
3
\$\begingroup\$

C#, 125 bytes

n=>{string f="One more {0} and I'm out",s=f;for(int i=0;i++<n;)s=string.Format(s,$"\"{f}\"");return string.Format(s,"LUL");};
\$\endgroup\$
6
  • \$\begingroup\$ I wonder if you can use string interpolation instead of Format... \$\endgroup\$
    – Bob
    Commented Jan 20, 2017 at 0:55
  • \$\begingroup\$ Change string to var to save two bytes. \$\endgroup\$
    – devRicher
    Commented Jan 20, 2017 at 7:06
  • \$\begingroup\$ @devRicher Can't because I'm declaring 2 variables \$\endgroup\$ Commented Jan 20, 2017 at 9:08
  • \$\begingroup\$ @Bob I'm already using it, not sure if I can use it elsewhere \$\endgroup\$ Commented Jan 20, 2017 at 9:09
  • \$\begingroup\$ Whoops, I didn't notice, sorry. \$\endgroup\$
    – Bob
    Commented Jan 20, 2017 at 9:33
3
\$\begingroup\$

C, 140 111 bytes

My first attempt at a golfing question.. Golfed:

#define F printf(
#define P 1&&putchar(34)
int a=0;void q(n){a=a?a:n,n?n>0?F"One more "),n-P:n?n+P,F" and I'm out"):0:F"LUL"),n+a?q(n-1):0;}

I have come to realise is the wrong output since q(0) just gives LUL. The next attempt:

#define o(Q) O(Q,n?34:0);
#define O printf
void q(int n){o("One more %c")n?q(n-1):O("LUL"),o("%c and I’m out")}

Example program (tested with GCC on OSX):

#define o(Q) O(Q,n?34:0);
#define O printf
void q(int n) {o("One more %c")n?q(n-1):O("LUL"),o("%c and I’m out")}

int main() {
    q(0),putchar('\n');
    q(1),putchar('\n');
    q(2),putchar('\n');
    q(3),putchar('\n');

    return 0;
}

Gives output

One more LUL and I’m out
One more "One more LUL and I’m out" and I’m out
One more "One more "One more LUL and I’m out" and I’m out" and I’m out
One more "One more "One more "One more LUL and I’m out" and I’m out" and I’m out" and I’m out
\$\endgroup\$
1
3
\$\begingroup\$

Mathematica, 69 68 bytes

Thanks to Martin Ender for saving 1 hard-to-find byte!

""<>Nest[{q="\"",{"One more ",#," and I'm out"},q}&,"LUL",#+1][[2]]&

Unnamed function taking a nonnegative integer argument and returning a string. Nest applies a function repeatedly to an initial argument; in this case, the function is to surround its argument by the appropriate words and quotation marks. We start from "LUL" and iterate N+1 times; that results in unwanted quotation marks enclosing the entire phrase, but [[2]] keeps only the stuff between them. At the end, ""<> turns the resulting heavily nested list into a single string.

Previous submission:

""<>Nest[{o,q="\"",#,q,a}&,{o="One more ","LUL",a=" and I'm out"},#]&
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Managed to shave off a byte by starting from LUL: ""<>Nest[{q="\"",{"One more ",#," and I'm out"},q}&,"LUL",#+1][[2]]& \$\endgroup\$ Commented Jan 20, 2017 at 12:17
  • \$\begingroup\$ Aha! [[2]]! That's how to get around those first undesired quotes :D \$\endgroup\$ Commented Jan 20, 2017 at 18:15
3
\$\begingroup\$

C#, 119 85 71 bytes

string m(int n)=>$"One more {(n<1?"LUL":$"\"{m(--n)}\"")} and I'm out";

Saved 14 bytes thanks to @Luc

\$\endgroup\$
7
  • \$\begingroup\$ Looks like it works (via LINQPad). Nice. Nested interped strings does sound a bit iffy, but it looks like it chokes on the ternary first. \$\endgroup\$
    – Bob
    Commented Jan 20, 2017 at 9:40
  • \$\begingroup\$ @Bob the problem I'm having trying to get it to work is because of the quotes, or at least that is what I think is causing it so I can't seem to remove the first string.Format and nest them \$\endgroup\$ Commented Jan 20, 2017 at 9:43
  • \$\begingroup\$ How about $"One more {(n<1?"LUL":$"\"{m(--n)}\"")} and I'm out" \$\endgroup\$
    – Luc
    Commented Jan 20, 2017 at 17:03
  • \$\begingroup\$ @Luc did you try that? Cos I'm sure I did something similar and it didn't work. On my phone right now so can't test \$\endgroup\$ Commented Jan 20, 2017 at 17:30
  • \$\begingroup\$ You can in any case replace string.Format with + to get 73 chars: \$\endgroup\$ Commented Jan 21, 2017 at 6:00
2
\$\begingroup\$

Retina, 51 bytes

.+
$*00LUL1$&$*
0
"One more 
1
 and I'm out"
^"|"$

Try it online!

\$\endgroup\$
2
\$\begingroup\$

R, 97 bytes

function(n){s="One more LUL and I'm out";while(n){s=sub("LUL",paste0('"',s,'"'),s);n=n-1};cat(s)}

Ungolfed:

function(n) {
  s = "One more LUL and I'm out";
  while(n) {
    s = sub("LUL", paste0('"', s, '"'), s);
    n = n - 1
  };
  cat(s)
}
\$\endgroup\$
2
\$\begingroup\$

R, 100 97 92 bytes

"One more recursive function and I'm out"

f=function(n)paste("One more",`if`(n<1,"LUL",paste0('"',f(n-1),'"')),"and I'm out");cat(f(scan()))

Edit: Turns out that a non-recursive approach is slightly shorter:

x="One more ";y=" and I'm out";cat(x,rep(c('"',x),n<-scan()),"LUL",rep(c(y,'"'),n),y,sep="")
\$\endgroup\$
2
\$\begingroup\$

Japt, 39 bytes

Thank you @ETHproductions for helping.

`"O Ú `p°U +"LUL"+` d I'm t"`pU)s1J

Try it here!

\$\endgroup\$
0
2
\$\begingroup\$

Ruby, 51 bytes

One-indexed. Try it online

->n{['One more ']*n*?"+'LUL'+[" and I'm out"]*n*?"}
\$\endgroup\$
2
\$\begingroup\$

PowerShell, 72 67 bytes

"$('"One more '*($c=1+"$args"))LUL$(' and I''m out"'*$c)".Trim('"')

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ "$('"One more '*($c=1+"$args"))LUL$(' and I''m out"'*$c)".Trim('"') shaved 5 by using a trim() instead of a join to skip the end "'s \$\endgroup\$
    – colsw
    Commented Jan 21, 2017 at 18:16
  • \$\begingroup\$ @ConnorLSW nice! good call, thank you \$\endgroup\$
    – briantist
    Commented Jan 21, 2017 at 19:30
2
\$\begingroup\$

Go, 104 82 105 bytes

func f(n int)string{if n<0{return"LUL"}
q:=``
if n!=0{q=`"`}
return`One more `+q+f(n-1)+q+` and I'm out`}

Attempt This Online!

  • -22 bytes by @Steffan: string concat instead of Sprintf
  • +23 bytes to follow spec (n=0 has no quotes)
\$\endgroup\$
1
1
\$\begingroup\$

Lua, 101 bytes

i,f,g='"One more ',' and I\'m out"',io.read()+1 print((i:rep(g).."LUL"..f:rep(g)):sub(2,g*24-(g-2)))

Obvious string attempt. Repeats "One more and and I'm out" exactly input + 1 times, with a LUL inbetween, then removes first and last quote.

\$\endgroup\$
0
1
\$\begingroup\$

Haskell, 51 bytes

Indexes from 1.

f 0="LUL";f n="One more \""++f(n-1)++"\" and I'm out"
\$\endgroup\$
2
  • 7
    \$\begingroup\$ This seems to incorrectly print the LUL in quotes. \$\endgroup\$
    – Zgarb
    Commented Jan 19, 2017 at 14:00
  • \$\begingroup\$ Easy to make index from 0 using f -1="LUL", but I don't see how to remove extra quotes without a bunch of new symbols. \$\endgroup\$
    – Wolfram
    Commented Jan 19, 2017 at 14:07
1
\$\begingroup\$

Ruby, 70 bytes

def l x,t="LUL";x.times{t='"One more %s and I\'m out"'%t};t[1..~1];end

Simply loops for the amount it's given, surrounding the last string via a format string each time.

Index starts at one.

\$\endgroup\$
1
\$\begingroup\$

Stacked, 54 bytes

('"One more ' ' and I''m out"')*'LUL'join'^.|.$'εrepl

Try it here! Example usage of "function":

1
('"One more ' ' and I''m out"')*'LUL'join'^.|.$'εrepl
out

One for 56 bytes:

@n'One more LUL and I''m out':@o['LUL' '"'o'"'+ +repl]n*
\$\endgroup\$
1
\$\begingroup\$

Python 3, 68 Bytes

def f(a):return('"One more '*a+'LUL'+(' and I%sm out"'%"'")*a)[1:-1]

\$\endgroup\$
2
  • \$\begingroup\$ This gives incorrect output. Did you mean *a instead of *5? \$\endgroup\$
    – mbomb007
    Commented Jan 19, 2017 at 22:04
  • \$\begingroup\$ Yes I did, thanks, I hadn't realised I'd put that \$\endgroup\$
    – AvahW
    Commented Jan 20, 2017 at 7:45
1
\$\begingroup\$

CJam, 51 49 bytes

" and I'm out\"""\"One more "li1+_@*"LUL"+1>@@*W<

Try it online

Ungolfed:

" and I'm out\""   "\"One more " // Push two strings to the stack
     l i 1 +                     // Read a number and add 1
     _ @                         // Copy number and rise '"One more ' to the top
     *                           // Multiply '"One more ' by a number
     "LUL" +                     // Add "LUL"
     1>                          // Chop the first quote
     @@                          // Push the result down
     *                           // Multiply ' and I\'m out"' by a number
     W<                          // Chop the last quote
\$\endgroup\$
5
  • \$\begingroup\$ You can use W instead of -1 to save one byte \$\endgroup\$ Commented Jan 19, 2017 at 14:42
  • 1
    \$\begingroup\$ Here are some other tricks to shorten this further: tio.run/nexus/cjam#@6/… ... I started by trying to avoid the \" by having a single string and adding the " to both ends with `. Then I needed to split the string which I couldn't do with a length and /, because the first part is shorter. So I used a linefeed as a separator and did N/. Since we now have both parts in a list, we can easily repeat both of them at once with f*. And the LUL is inserted at the end with a simple join (*). \$\endgroup\$ Commented Jan 19, 2017 at 14:50
  • \$\begingroup\$ That's cool, but it looks more like completely different solution than shortening this further :) That's my first program on CJam, so I didn't know these tricks, thanks. Should I add this solution to the answer? \$\endgroup\$
    – Wolfram
    Commented Jan 19, 2017 at 15:04
  • \$\begingroup\$ @Wolfram It's up to you. I'm happy for you to use it (otherwise I wouldn't have commented ;)). \$\endgroup\$ Commented Jan 20, 2017 at 12:14
  • \$\begingroup\$ @Wolfram a nice first effort! You'll probably benefit a lot by going through Martin's answer \$\endgroup\$
    – A Simmons
    Commented Jan 20, 2017 at 15:43
1
\$\begingroup\$

Groovy, 54 bytes

{x->('"One more '*x+'LUL'+' and I\'m out\"'*x)[1..-2]}

Pretty straightforward, same as the python answer but 2 bytes shorter. It is also 1-indexed.

Try it Online!

\$\endgroup\$
1
\$\begingroup\$

Mathematica, 65 63 Bytes

Nest["\"One more "<>#<>" and I'm out\""&,"LUL",#]~StringTrim~_&

Two bytes off by noticing the challenge allows 1-indexing.

\$\endgroup\$
1
\$\begingroup\$

PHP

Hello, i found so far two ways for doing this.

The replacement way 1-indexed (121 bytes).

function f($x){$v='One more LUL and i\'m out';$t=$v;for($i=1;$i<=$x;$t=str_replace('LUL','"'.$t.'"',$v),$i++);return $t;}

The recursive way (86 bytes).

function r($n){$v=($n==0)?'LUL':'"'.r($n-1).'"';return'One more '.$v.' and i\'m out';}
\$\endgroup\$
1
  • \$\begingroup\$ In php, programs are almost always shorter than functions. \$\endgroup\$
    – Titus
    Commented Feb 16, 2017 at 14:11
1
\$\begingroup\$

C++, 80 + 16 = 96 bytes

std::string L(int c){return"One more "+(c?'"'+L(--c)+'"':"LUL")+" and I'm out";}

#include<string> - +16

Ungolfed:

std::string LUL(int count) {
    return "One more " + (count? ('"' + LUL(--count) + '"') : "LUL") + " and I'm out";
}

Calls itself recursively and uses string addition. Pretty straight forward. I mean what else can I say? Even the ungolfed version is essentially a one liner.

Try it online!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.