One more LUL and I'm out

57

6

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

shooqie

Posted 2017-01-19T11:33:23.993

Reputation: 5 032

6can I add " in the start and end too? – Rod – 2017-01-19T11:44:59.200

1Very similar (Task 5) – Mego – 2017-01-19T11:55:38.030

8@Rod: No, you cannot. – shooqie – 2017-01-19T12:07:31.307

27The title of this challenge is very awkward for Dutch speakers... – None – 2017-01-19T14:12:38.270

5@Pakk But it's true. I see a LUL, and I'm outta here... – steenbergh – 2017-01-19T14:20:27.697

7This can be extended to YOLO: You Only YOLO once --> YOYOLOO. You Only YOYOLOO Once --> YOYOYOLOOO, etc. – James – 2017-01-19T16:07:07.350

Shouldn't the start be One more "LUL" and I'm out? – Magic Octopus Urn – 2017-01-19T17:34:10.187

2

Since I'm bored, here's a Perl-compatible regex that can match any string that could possibly be produced by the programs that are valid entries to this challenge: https://regex101.com/r/7s0CRl/1

– user8397947 – 2017-01-20T00:21:41.623

1Nice challenge! – qwr – 2017-01-20T05:11:48.907

4Can it be even more impressive, and follow "standard" English style by alternating “” and ‘’ ?? – WGroleau – 2017-01-20T23:00:43.623

Answers

24

Python 2, 56 bytes

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

Try it online!
It is 1-indexed

Rod

Posted 2017-01-19T11:33:23.993

Reputation: 17 588

3I assume the [1:-1] at the end trims the double quotes at the start and end? – Nzall – 2017-01-19T13:13:44.900

@Nzall Precisely – Rod – 2017-01-19T13:15:54.537

For x=0 this gives 'U', but should give "One more LUL and I'm out". – Wolfram – 2017-01-19T14:30:06.310

3@Wolfram It is 1-indexed, added this info to the answer – Rod – 2017-01-19T14:36:31.547

18

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"

user41805

Posted 2017-01-19T11:33:23.993

Reputation: 16 320

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. – Patrick Roberts – 2017-01-19T14:58:11.450

@PatrickRoberts Thanks, I don't know why I have an extra input field :) – user41805 – 2017-01-19T15:01:22.007

Nice, I probably would've tried using .replace. – ETHproductions – 2017-01-19T16:49:15.410

Stack overflows when number is negative. – programmer5000 – 2017-04-06T12:10:44.307

@programmer500 The input number is given to be non-negative so that is not a problem – user41805 – 2017-04-06T14:37:35.807

I know, just wanted to point that out. – programmer5000 – 2017-04-06T14:59:18.373

11

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.

James Holderness

Posted 2017-01-19T11:33:23.993

Reputation: 8 298

Nice use of get to push a ". Thanks for the explanation – MildlyMilquetoast – 2017-01-19T21:07:50.920

6

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.

Matthew Roh

Posted 2017-01-19T11:33:23.993

Reputation: 5 043

@Kritixi Now it has a snippet. – Matthew Roh – 2017-01-19T12:42:31.677

This is shorter. And I think you might need to include the <string> import statement into the bytecount, not sure – user41805 – 2017-01-19T12:47:13.840

Also you can change the for(int i=0;i<x;i++) to for(int i=0;i++<x;) – user41805 – 2017-01-19T12:50:52.533

Additionally, r.find("L") is shorter than r.find("LOL") by 2 bytes :) – user41805 – 2017-01-19T12:57:51.600

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.

– nmjcman101 – 2017-01-19T18:35:52.583

Also you may be able to use '"' (single double single) instead of "\"" in the above code – nmjcman101 – 2017-01-19T18:38:24.050

I am using single double single already. – Matthew Roh – 2017-01-20T00:24:12.743

You don't need to find r.find("L") when you can calculate it from i (i*10-1) – hvd – 2017-01-21T10:27:49.233

@hvd I know, but r.find("L") was more efficient for me. – Matthew Roh – 2017-01-21T10:29:06.540

@MatthewRoh Efficient in what way? r.find("L") is 11 characters, i*10-1 is 6. This is code golf, so shorter is better, right? – hvd – 2017-01-21T10:30:45.880

Good point. @hvd – Matthew Roh – 2017-01-21T10:31:51.133

Also, the return type can be auto instead of string to save two more characters. And I think you need to either include using namespace std; in your character count, or write std::string, but I'm not sure on that. – hvd – 2017-01-21T10:32:17.647

Changing ,r=k to ;auto r=k wasn't necessary, that part was valid even with std::string. Your link no longer works since your demo program now also needs std::cin/std::cout/std::endl :) – hvd – 2017-01-21T10:42:27.017

I found a short version that uses recurrsion. http://codegolf.stackexchange.com/a/107654/23417

– BrainStone – 2017-01-22T08:05:01.753

@BrainStone I wont copy that. Reasons? 1. I dont want to copy others answers. 2. I dont like recursions, Its very inefficient – Matthew Roh – 2017-01-22T15:57:37.267

6

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.

Emigna

Posted 2017-01-19T11:33:23.993

Reputation: 50 798

5

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.

user64039

Posted 2017-01-19T11:33:23.993

Reputation:

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 – Farhan Anam – 2017-01-22T08:20:14.873

2@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. – None – 2017-01-23T09:43:08.810

5

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                             /".."

nmjcman101

Posted 2017-01-19T11:33:23.993

Reputation: 3 274

It is LUL and not LOL ;) – geisterfurz007 – 2017-01-19T15:31:51.397

4

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

user18932

Posted 2017-01-19T11:33:23.993

Reputation:

You can change both "\"" to '"' (single chars) to save 2 bytes. – Kevin Cruijssen – 2017-01-20T08:04:00.287

1@KevinCruijssen thanks, I knew there was something I missed. – None – 2017-01-20T15:26:35.307

3

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

mbomb007

Posted 2017-01-19T11:33:23.993

Reputation: 21 944

3

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");};

TheLethalCoder

Posted 2017-01-19T11:33:23.993

Reputation: 6 930

I wonder if you can use string interpolation instead of Format...

– Bob – 2017-01-20T00:55:08.027

Change string to var to save two bytes. – devRicher – 2017-01-20T07:06:05.733

@devRicher Can't because I'm declaring 2 variables – TheLethalCoder – 2017-01-20T09:08:23.897

@Bob I'm already using it, not sure if I can use it elsewhere – TheLethalCoder – 2017-01-20T09:09:02.767

Whoops, I didn't notice, sorry. – Bob – 2017-01-20T09:33:14.243

@Bob On my other answer I tried using one inside another and have struggled to get it to work though so if I manage to get that to happen I can use the same logic here – TheLethalCoder – 2017-01-20T09:36:39.973

3

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

TheLethalCoder

Posted 2017-01-19T11:33:23.993

Reputation: 6 930

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. – Bob – 2017-01-20T09:40:05.680

@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 – TheLethalCoder – 2017-01-20T09:43:10.933

How about $"One more {(n<1?"LUL":$""{m(--n)}"")} and I'm out" – Luc – 2017-01-20T17:03:15.913

@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 – TheLethalCoder – 2017-01-20T17:30:17.783

You can in any case replace string.Format with + to get 73 chars: – Chris F Carroll – 2017-01-21T06:00:05.233

string m2(int n)=>"One more "+(n<1?"LUL":$""{m(--n)}"")+" and I'm out"; – Chris F Carroll – 2017-01-21T06:00:15.097

Yes you can nest. But you have to add (parentheses) around the ternary to do it. So Luc's is good. – Chris F Carroll – 2017-01-21T06:26:37.837

3

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"},#]&

Greg Martin

Posted 2017-01-19T11:33:23.993

Reputation: 13 940

1Managed to shave off a byte by starting from LUL: ""<>Nest[{q="\"",{"One more ",#," and I'm out"},q}&,"LUL",#+1][[2]]& – Martin Ender – 2017-01-20T12:17:16.157

Aha! [[2]]! That's how to get around those first undesired quotes :D – Greg Martin – 2017-01-20T18:15:15.277

3

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

Ahemone

Posted 2017-01-19T11:33:23.993

Reputation: 608

104 bytes – ceilingcat – 2019-11-13T03:50:02.390

2

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="")

Billywob

Posted 2017-01-19T11:33:23.993

Reputation: 3 363

2

Retina, 51 bytes

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

Try it online!

Martin Ender

Posted 2017-01-19T11:33:23.993

Reputation: 184 808

2

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)
}

Sven Hohenstein

Posted 2017-01-19T11:33:23.993

Reputation: 2 464

2

PowerShell, 72 67 bytes

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

Try it online!

briantist

Posted 2017-01-19T11:33:23.993

Reputation: 3 110

"$('"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 – colsw – 2017-01-21T18:16:53.137

@ConnorLSW nice! good call, thank you – briantist – 2017-01-21T19:30:56.953

2

Japt, 39 bytes

Thank you @ETHproductions for helping.

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

Try it here!

Oliver

Posted 2017-01-19T11:33:23.993

Reputation: 7 160

2

Ruby, 51 bytes

One-indexed. Try it online

->n{['One more ']*n*?"+'LUL'+[" and I'm out"]*n*?"}

Value Ink

Posted 2017-01-19T11:33:23.993

Reputation: 10 608

1

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.

devRicher

Posted 2017-01-19T11:33:23.993

Reputation: 1 609

1

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*

Conor O'Brien

Posted 2017-01-19T11:33:23.993

Reputation: 36 228

1

PHP, 69 66 bytes

Note: uses IBM-850 encoding

for($o=LUL;~$argn--;$d=~¦)$o="One more $d$o$d and I'm out";echo$o;

Run like this:

echo 2 | php -nR 'for($o=LUL;~$argn--;$d=~¦)$o="One more $d$o$d and I'"'"'m out";echo$o;';echo
> One more "One more "One more LUL and I'm out" and I'm out" and I'm out

Explanation

for(
  $o=LUL;                           # Start with output string "LUL".
  ~$argn--;                         # Loop until N is -1.
  $d=~¦                             # Set delimiter to `"` after first
                                    #   iteration.
)
  $o="One more $d$o$d and I'm out"; # Add text with previous output
                                    #   embedded, between delims.

echo$o;                             # Output resulting string.

aross

Posted 2017-01-19T11:33:23.993

Reputation: 1 583

@devRicher and aross: We have a Be Nice policy—please remember to follow it and act with a civil tone, even when disagreeing with someone.

– Doorknob – 2017-01-20T16:40:21.037

@Doorknob I'm sure you'll agree that an accusation of cheating is uncalled for. I'm also sure that his downvote (which still stands) should be removed, as I corrected my answer – aross – 2017-01-23T09:30:40.843

1

Haskell, 51 bytes

Indexes from 1.

f 0="LUL";f n="One more \""++f(n-1)++"\" and I'm out"

gntskn

Posted 2017-01-19T11:33:23.993

Reputation: 243

7This seems to incorrectly print the LUL in quotes. – Zgarb – 2017-01-19T14:00:50.207

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. – Wolfram – 2017-01-19T14:07:28.173

1

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

Wolfram

Posted 2017-01-19T11:33:23.993

Reputation: 231

You can use W instead of -1 to save one byte – Business Cat – 2017-01-19T14:42:09.013

1

Here are some other tricks to shorten this further: https://tio.run/nexus/cjam#@6/kn5eqkJtflKrApZCYl6LgqZ6rkF9aopTgp1@UqZmmpeQT6qOkZWgXbvP/vxEA ... 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 didN/. Since we now have both parts in a list, we can easily repeat both of them at once withf. And theLULis inserted at the end with a simple join (`).

– Martin Ender – 2017-01-19T14:50:07.850

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? – Wolfram – 2017-01-19T15:04:33.077

@Wolfram It's up to you. I'm happy for you to use it (otherwise I wouldn't have commented ;)). – Martin Ender – 2017-01-20T12:14:48.847

@Wolfram a nice first effort! You'll probably benefit a lot by going through Martin's answer – A Simmons – 2017-01-20T15:43:18.023

1

Python 3, 68 Bytes

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

sonrad10

Posted 2017-01-19T11:33:23.993

Reputation: 535

This gives incorrect output. Did you mean *a instead of *5? – mbomb007 – 2017-01-19T22:04:20.817

Yes I did, thanks, I hadn't realised I'd put that – sonrad10 – 2017-01-20T07:45:13.700

1

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.

NO_BOOT_DEVICE

Posted 2017-01-19T11:33:23.993

Reputation: 419

1

Mathematica, 65 63 Bytes

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

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

A Simmons

Posted 2017-01-19T11:33:23.993

Reputation: 4 005

1

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!

Gurupad Mamadapur

Posted 2017-01-19T11:33:23.993

Reputation: 1 791

1

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';}

Antoine B.

Posted 2017-01-19T11:33:23.993

Reputation: 11

In php, programs are almost always shorter than functions. – Titus – 2017-02-16T14:11:35.470

1

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!

BrainStone

Posted 2017-01-19T11:33:23.993

Reputation: 1 501

1

Common Lisp, 90 89 108 105 103 bytes

(set's"One more LUL and I'm out")(dotimes(n(read)(princ s))(set's(format()"One more ~a and I'm out"s)))

Other solution (91 bytes)

Using Winny's solution in Racket (my is not exact copy)

(defun l(n)(if(< n 0)'LUL(format()"One more ~:[~a~;\"~a\"~] and I'm out"(> n 0)(l(1- n)))))

usage:

(format t"~a"(l 2))

Ideas for improvement are welcomed.

user65167

Posted 2017-01-19T11:33:23.993

Reputation:

1

Cheddar, 71 bytes

i->('One more "'*i).slice(0,-1)+'LUL '+('and I\'m out" '*i).slice(0,-2)

Try it online!

Pavel

Posted 2017-01-19T11:33:23.993

Reputation: 8 585

Maybe try recursion with _ f -> syntax which may save some bytes – Downgoat – 2017-02-14T18:13:07.410

Uhh, I'm not really familiar with how that syntax works, and I can't find it or any examples in the docs. – Pavel – 2017-02-14T18:19:30.637

1

Jelly, 39 bytes

First Jelly submission! Can probably slice off a few by encoding the strings, but I couldn't get it working with the spaces yet.

“"One more ”;;“ and I'm out"”
“LUL”Ç¡ḊṖ

A 0-indexed version needs an additional Ç after the Ç¡.

Try it online!

Explanation will follow soon!

PidgeyUsedGust

Posted 2017-01-19T11:33:23.993

Reputation: 631

1

Haskell - 73 bytes

n!s=[1..n]>>s
f n=init(n!"One more \"")++" LUL"++tail(n!"\" and I'm out")

I wonder if there something I could use besides init and tail to save a few bytes.

Try it here!

Aneesh Durg

Posted 2017-01-19T11:33:23.993

Reputation: 239

There is an extra space in " LUL" which should be removed. – Laikoni – 2017-06-14T05:35:49.173

0

Perl 6, 57 bytes

{substr "\"One more "x$_~"LUL"~" and I'm out\""x$_,1,*-1}

Slightly more interesting, but 58 bytes:

{join "LUL",("One more "," and I'm out"Xxx$_)».join('"')}

smls

Posted 2017-01-19T11:33:23.993

Reputation: 4 352

0

Clojure, 84 bytes

#(nth(iterate(fn[s](str"One more \""s"\" and I'm out"))"One more LUL and I'm out")%)

Argh why isn't the first LUL in quotes? :( Almost correct in 63 bytes:

#(nth(iterate(fn[s](str"One more \""s"\" and I'm out"))"LUL")%)

NikoNyrh

Posted 2017-01-19T11:33:23.993

Reputation: 2 361

0

GameMaker Language, 106 bytes

1-indexed

s='LUL'for(a=0,a<argument0;a++)s='"One more '+s+" and I'm out\""return string_copy(s,2,string_length(s)-2)

Timtech

Posted 2017-01-19T11:33:23.993

Reputation: 12 038

0

Clojure, 90 bytes

(fn c[n](if(= n -1)"LUL"(let[q(if(> n 0) \")](str"One more "q(c(dec n))q" and I'm out"))))

Written and golfed on my phone on a soft keyboard using the "Clojure REPL" app. That was sure a treat.

Explicitly recursive solution. Inserts the results of recursing into the "template string".

Pregolfed:

(defn lul [n]
  (if (= n -1)
    "LUL"
    (let [quote? (if (> n 0) \")]
      (str "One more "
            quote? (lul (dec n)) quote?
           " and I'm out" ))))

Carcigenicate

Posted 2017-01-19T11:33:23.993

Reputation: 3 295

0

Octave, 72 70 bytes

@(n)[{'"One more '}{o=!(1:n)+1} "LUL " {"and I'm out\" "}{o}](2:end-2)

1 based index

Try It Online!

rahnema1

Posted 2017-01-19T11:33:23.993

Reputation: 5 435

0

PowerShell, 88 bytes

for($d=($s="One more LUL and I'm out");$i++-lt$args[0]){$d=$d.Replace("LUL","`"$s`"")}$d

mcmurdo

Posted 2017-01-19T11:33:23.993

Reputation: 71

0

Batch, 95 bytes

@set s=LUL
@for /l %%i in (0,1,%1)do @call set s="One more %%s%% and I'm out"
@echo %s:~1,-1%

0-indexed, because that means it works even if you forget to pass a parameter. (The 1-indexed version would just print U in that case, which looks silly.)

Neil

Posted 2017-01-19T11:33:23.993

Reputation: 95 035

0

C#, 102 90 bytes

string l(string s,int n){return n<0?s.Substring(1,s.Length-2):l($"\"One more {s} and I'm out\"",--n);}

Recursive, call with l("LUL",7);

EDIT

Thank you for pointing out that it is illegal to pass input not specified in the challenge. Here is the fixed version that only takes an integer N:

string l(int N){return N<0?"":$"One more \"{l(--N)}\" and I'm out".Replace("\"\"","LUL");}

Georg Patscheider

Posted 2017-01-19T11:33:23.993

Reputation: 101

1

You can't assume that this string is passed as input. It's a standard loophole, which is forbidden by default. - @Zgarb in the deleted Java 7 answer

– Value Ink – 2017-01-19T21:18:38.790

Sorry I am new to this. Do I have to add the call to the total bytes? Or find another solution that does only assume an int N as input? – Georg Patscheider – 2017-01-19T21:20:00.850

2You need to find another solution that only assumes the integer – Blue – 2017-01-19T21:31:20.980

Another option is to use C#'s optional arguments thing, so string l(int n,string s="LUL") works as well. But your new solution is now shorter anyways, so it might be better to just leave it as is! Unless someone else with more C# knowledge knows how to golf it further, of course. – Value Ink – 2017-01-19T21:52:34.243

0

Racket, 88 87 bytes

(define(f n)(format"One more ~a and I'm out"(if(= n 0)'LUL(format"\"~a\""(f(- n 1))))))

Ungolfed

(define (f n)
  (format "One more ~a and I'm out"
          (if (= n 0)
              'LUL
              (format "\"~a\"" (f (- n 1))))))

Unit tests

(module+ test
  (require rackunit)
  (check-equal? (f 0) "One more LUL and I'm out")
  (check-equal? (f 1) "One more \"One more LUL and I'm out\" and I'm out")
  (check-equal? (f 2) "One more \"One more \"One more LUL and I'm out\" and I'm out\" and I'm out")
  (check-equal? (f 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"))

Winny

Posted 2017-01-19T11:33:23.993

Reputation: 1 120

1I tried it on my PC and it seems your code outputs additional " on beggining and end. Also for n>=1 output should be One more "One more LUL and I'm out" and I'm out without backslash before " etc. It is possible that I have some old version of Racket but please look into it. Also - you can save one byte with 'LUL instead of "LUL" – None – 2017-02-18T11:14:15.403

@PrzemysławP In the Racket string "a\"b\"c", typing it into the repl will result the same as what you typed, you want to do (displayln "a\"b\"c") which outputs just a"b"c. Nice catch on the -1 byte, thanks! – Winny – 2017-02-18T21:36:02.473

So your function outputs string that is appropriate for other function to read and output what is needed. I doesn't output what is needed on its own. But probably you know better than me what is allowed - I may try to use this somewhere. – None – 2017-02-20T11:05:54.793

@PrzemysławP Could you clarify what isn't correct in this answer? I have no clue what you're going on about. – Winny – 2017-02-21T03:04:07.010

I am sorry for confusion. What I think may be incorrect is that output contains escape characters and quotes. To get rid of them you need to use other function on it (displayln if I understand you correctly). However it is possible that it is allowed, hence my "But probably you know better than me what is allowed(...)". To put it straight: when I write to REPL function definition and function call it displays different thing than what is defined in "Sample Input/Output" section in question. – None – 2017-02-21T09:41:07.227

0

Scala, 63 bytes

(n:Int)=>("One more \""*n init)+"LUL"+("\" and I'm out"*n tail)

1-indexed

jaxad0127

Posted 2017-01-19T11:33:23.993

Reputation: 281

0

C++, 183 bytes

Simply input N times you want 'One more LUL' nested.

#include <iostream>
#include <string>
#define s string
using namespace std;main(){int N;cin>>N;s a="LUL";s b="One more \"";s c="\"and I'm out";for(int i=0;i<N;i++){a=b+a+c;}cout<<a;}

Try Me Online!

GCaldL

Posted 2017-01-19T11:33:23.993

Reputation: 21

doesn't work. 1 should output "one more LUL and I'm out" with no quotes – Destructible Lemon – 2017-02-06T01:30:24.047

0

tcl, 88

set g [set f "One more LUL and I'm out"]
time {regsub -all LUL $f "\"$g\"" f} $n
puts $f

demo

sergiol

Posted 2017-01-19T11:33:23.993

Reputation: 3 055

0

C++14, 90 bytes

As unnamed lambda modifying its input. Requires s to be std::string or alike.

[](auto&s,int i){s="LUL",++i;for(char c=0;i--;s="One more "+(c+s+c)+" and I'm out",c=34);}

Ungolfed and usage:

#include<string>
#include<iostream>

auto f=
[](auto&s,int i){
 s="LUL",++i;        //set basic LUL
 for(
  char c=0;          //first string concat without quotes
  i--;               
  s="One more "+(c+s+c)+" and I'm out", //string concat
  c=34                                  //set c to "
 );
}
;

int main(){
 std::string s;
 f(s,0);
 std::cout << s << std::endl;
 f(s,1);
 std::cout << s << std::endl;
 f(s,2);
 std::cout << s << std::endl;
 f(s,3);
 std::cout << s << std::endl;
}

Karl Napf

Posted 2017-01-19T11:33:23.993

Reputation: 4 131

does this output null bytes? – Destructible Lemon – 2017-02-06T01:28:37.280

@DestructibleWatermelon no, it just works. I guess adding the null-char is just ignored. – Karl Napf – 2017-02-06T01:40:23.903

1how did you check exactly? – Destructible Lemon – 2017-02-06T01:50:07.967

By running and checking the output. – Karl Napf – 2017-02-13T10:11:07.900

0

Objective-C, 218

#define p NSString stringWithFormat
-(NSString *)f:(int)a{NSString *o=@"One more ",*k=@" and I'm out",*i=[p:@"%@LUL%@",o,k],*s=@"";for(int j=-a;a-->j+1;s=[p:@"%@\"%@",s,a>0?o:a<0?k:i]);return [s substringFromIndex:1];}

Not the most beautiful language to golf in, but I had fun

Albert Renshaw

Posted 2017-01-19T11:33:23.993

Reputation: 2 955

0

QBIC, 72 bytes

:[a|X=X+@One more `+chr$(34)┘Z=Z+chr$(34)+@ and I'm out`]Z=X+A+@LUL`+B+Z

The chr$(34) for the quotes is particularly costly, I need to fix a bug in the interpreter to make them work inside a string literal...

Sample output:

Command line: 0
One more LUL and I'm out

Command line: 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

steenbergh

Posted 2017-01-19T11:33:23.993

Reputation: 7 772

0

dc, 82 bytes

?dsasw[[LUL ]P]se[34dP]sr[lalw>r[One more ]nlad1-dsar1=e0<y[and I'm out]nP32P]dsyx

Might as well add an answer in dc. This is 1-indexed.

"Calculate" it on the Internet!

R. Kap

Posted 2017-01-19T11:33:23.993

Reputation: 4 730

0

Python, 78 bytes

f=lambda n:'One more "'*(n-1)+"One more LUL and I'm out"+'" and I\'m out'*(n-1)

iwaseatenbyagrue

Posted 2017-01-19T11:33:23.993

Reputation: 231

0

k, 58 bytes

Indexing starts at 0. This is a recursive function.

`0:`c${"One more ",$[x;34,o[x-1],34;"LUL"]," and I'm out"}

Try it online.

zgrep

Posted 2017-01-19T11:33:23.993

Reputation: 1 291

0

GolfScript, 44 bytes

~"LUL"\{'"One more 
 and I\'m out"'n/*}*(;);

Try it online!

1-indexed.

Explanation:

~"LUL"\{'"One more \n and I\'m out"'n/*}*(;); ("\n" is a newline)
~                                             Eval (input is the only stack element on program start)
 "LUL"                                        Push "LUL"
      \                                       Swap
       {'"One more \n and I\'m out"'n/*}      Push block:
        '"One more \n and I\'m out"'            Push "\"One more \n and I'm out\""
                                    n           Push n (default: newline)
                                     /          Split
                                      *         Join
                                        *     Repeat block
                                         (    Pop first element and push to stack
                                          ;   Pop
                                           )  Pop last element and push to stack
                                            ; Pop

Erik the Outgolfer

Posted 2017-01-19T11:33:23.993

Reputation: 38 134

0

SOGL V0.12, 27 bytes

LUL”.I{" ž-┌πēj░ō|≥π┘⁴‘⁾}jk

Try it Here!

dzaima

Posted 2017-01-19T11:33:23.993

Reputation: 19 048

0

Perl 5, 55 + 1 (-p) = 56 bytes

$_='"One more 'x++$_.LUL.' and I\'m out"'x$_;s/^.|.$//g

Try it online!

Xcali

Posted 2017-01-19T11:33:23.993

Reputation: 7 671