3
\$\begingroup\$

I do not believe this question to be a duplicate of this one, since this one requires more string manipulation, if it is still a duplicate feel free to close this question

Introduction

Your challenge today is to output the lyrics of "99 bottles of beer":

99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall.

98 bottles of beer on the wall, 98 bottles of beer.
Take one down and pass it around, 97 bottles of beer on the wall.

97 bottles of beer on the wall, 97 bottles of beer.
Take one down and pass it around, 96 bottles of beer on the wall.

96 bottles of beer on the wall, 96 bottles of beer.
Take one down and pass it around, 95 bottles of beer on the wall.

95 bottles of beer on the wall, 95 bottles of beer.
Take one down and pass it around, 94 bottles of beer on the wall.

....

3 bottles of beer on the wall, 3 bottles of beer.
Take one down and pass it around, 2 bottles of beer on the wall.

2 bottles of beer on the wall, 2 bottles of beer.
Take one down and pass it around, 1 bottle of beer on the wall.

1 bottle of beer on the wall, 1 bottle of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.

But the twist is that you wont always start from 99, and you wont always buy some more beer from the store, because they don't have infinitely many bottles of beer you know!

Input

A positive integer x > 1, a string y and a string z

Output and Test Cases

A string containing the lyrics of the song except that instead of starting from 99 bottles of beer, you start from x bottles of y, and the ys are on the z. So given a value of x equal to 3, y equal to "Pepsi", and z equal to "fridge" your output should be:

3 bottles of Pepsi on the fridge, 3 bottles of Pepsi.
Take one down and pass it around, 2 bottles of Pepsi on the fridge.

2 bottles of Pepsi on the fridge, 2 bottles of Pepsi.
Take one down and pass it around, 1 bottle of Pepsi on the fridge.

1 bottle of Pepsi on the fridge, 1 bottle of Pepsi.
Go to the store and buy some more, 3 bottles of Pepsi on the fridge.

Scoring

Lowest byte count wins.

\$\endgroup\$
12
  • \$\begingroup\$ Here's the original for inspiration. Is this too similar? \$\endgroup\$
    – BradC
    Oct 30, 2018 at 16:32
  • 2
    \$\begingroup\$ I'm on the fence as to whether this is different enough than the plain 99BB challenge, but since my vote is a hammer I won't close-vote it as yet. \$\endgroup\$ Oct 30, 2018 at 16:39
  • \$\begingroup\$ (You use x in one place and n in another, please fix). Does my program need to handle only n up to 99? Or 9,999? 2,147,483,647? \$\endgroup\$
    – BradC
    Oct 30, 2018 at 16:42
  • \$\begingroup\$ @BradC You need to handle any values of x, also will fix \$\endgroup\$
    – kepe
    Oct 30, 2018 at 16:57
  • 3
    \$\begingroup\$ This is uninspired, to say the very least. Is it original? No. Is it interesting? No. Does it add anything new or exciting to the other, similar, challenge? No. Is it similar? Yes. Should we close it? Probably. That being said, don't let this dissuade you from writing more challenges, just, probably, spend more time on them and make them interesting. \$\endgroup\$ Oct 30, 2018 at 17:29

0

Browse other questions tagged or ask your own question.