78
\$\begingroup\$

"Baby Shark" is a children's song about a family of sharks. Having long been popular as a campfire song, it has been popularized since the mid-2000s by social media, online video and radio. - Wikipedia

Write program that takes no input, and writes the following text to the standard output or an arbitrary file:

Baby Shark doo doo doo doo doo doo
Baby Shark doo doo doo doo doo doo
Baby Shark doo doo doo doo doo doo
Baby Shark!
Daddy Shark doo doo doo doo doo doo
Daddy Shark doo doo doo doo doo doo
Daddy Shark doo doo doo doo doo doo
Daddy Shark!
Mommy Shark doo doo doo doo doo doo
Mommy Shark doo doo doo doo doo doo
Mommy Shark doo doo doo doo doo doo
Mommy Shark!
Grandpa Shark doo doo doo doo doo doo
Grandpa Shark doo doo doo doo doo doo
Grandpa Shark doo doo doo doo doo doo
Grandpa Shark!
Grandma Shark doo doo doo doo doo doo
Grandma Shark doo doo doo doo doo doo
Grandma Shark doo doo doo doo doo doo
Grandma Shark!

This is code golf — shortest code wins.

Found this on Reddit^1^2, and it seems like an interesting challenge to golf.

Updates:

No newline between stanzas, that makes it too easy :)

Leading/trailing newlines are okay.

\$\endgroup\$
18
  • 6
    \$\begingroup\$ Is a newline between each stanza (each shark) acceptable? (That's always how I've seen the lyrics written) \$\endgroup\$
    – Quintec
    Feb 16 '19 at 2:00
  • 9
    \$\begingroup\$ Eh, missing a few verses, like all the ones about the swimmers swimming and losing limbs in shark attacks. \$\endgroup\$
    – mbomb007
    Feb 16 '19 at 17:23
  • 3
    \$\begingroup\$ "doo doo doo doo doo doo" is really over-simplified. \$\endgroup\$ Feb 17 '19 at 23:54
  • 32
    \$\begingroup\$ As a parent, I feel the strongest urge to downvote this one. I'm repressing the urge because that's not how Stack Exchange works. But if I find myself humming "doo doo doo doo" later today, I'm coming back here and holding you accountable! \$\endgroup\$
    – Cort Ammon
    Feb 18 '19 at 17:22
  • 5
    \$\begingroup\$ How many people's days ruined now that this is on HNQs? \$\endgroup\$
    – CactusCake
    Feb 18 '19 at 19:49

66 Answers 66

2
\$\begingroup\$

cQuents, 93 89 bytes

|
#20&bk)~" Shark"~(" doo"6,Z,Z,bk)~" Shark!"
:"Baby","Daddy","Mommy","Grandpa","Grandma"

Try it online!

Note that as of posting TIO is not updated to the latest version, so the TIO link may not work.

Explanation

|                               Set delimiter to newline
#20                             n = 20
   &                            Output first n terms in sequence
                                k = 1
                                First term is
    bk)~" Shark"                 kth term from the third line concatenated to " Shark"
                ~(" doo"6,        concatenated to " doo" repeated 6 times
Z,Z,                            Second and third terms equal the first term
    bk)~" Shark!"               Fourth term is the kth term from the third line concatenated to " Shark!"
                                k += 1, restart

Third line                      5 terms, each a string
\$\endgroup\$
2
\$\begingroup\$

JavaScript (Node.js), 132 bytes

Probably very golf-able. Generates the "doo doo" line, then creates three of those with the "!" line after, and repeats this for each shark.

a=""
c=" doo"
for(b of["Baby","Daddy","Mommy","Grandpa","Grandma"]){b+=" Shark"
t=b+c+c+c+c+c+c+"\n"
a+=t+t+t+b+"!\n"}console.log(a)

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ A slightly changed solution in Javascript, no gain though: a="";c=" doo";for(b of["Baby","Daddy","Mommy","Grandpa","Grandma"]){b+=" Shark";t=b+c.repeat(6)+"\n";a+=t+t+t+b+"!\n"}console.log(a) \$\endgroup\$
    – BogdanBiv
    Feb 19 '19 at 8:52
2
\$\begingroup\$

Japt -R, 55 bytes

Pretty naïve first pass.

`baß'adÝcomæ²T\`èT\`µ`qi Ë'!i4Æ` Srk`iDhDÎuÃqRi6ç` ºo

Test it

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

Stax, 43 bytes

ÇÉ╕µM%╠2'§t╪╝½ôòn=n╢/╬╦Φ▲Vêø■T⌂g^N┴W.ìC↕ƒ·Φ

Run and debug it

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

jq, 87 characters

" Shark"as$s|("Baby Daddy Mommy Grandpa Grandma"/" ")[]|(.+$s+" doo"*6+"\n")*3+.+$s+"!"

Sample run:

bash-4.4$ jq -nr '" Shark"as$s|("Baby Daddy Mommy Grandpa Grandma"/" ")[]|(.+$s+" doo"*6+"\n")*3+.+$s+"!"'
Baby Shark doo doo doo doo doo doo
Baby Shark doo doo doo doo doo doo
Baby Shark doo doo doo doo doo doo
Baby Shark!
Daddy Shark doo doo doo doo doo doo
Daddy Shark doo doo doo doo doo doo
Daddy Shark doo doo doo doo doo doo
Daddy Shark!
Mommy Shark doo doo doo doo doo doo
Mommy Shark doo doo doo doo doo doo
Mommy Shark doo doo doo doo doo doo
Mommy Shark!
Grandpa Shark doo doo doo doo doo doo
Grandpa Shark doo doo doo doo doo doo
Grandpa Shark doo doo doo doo doo doo
Grandpa Shark!
Grandma Shark doo doo doo doo doo doo
Grandma Shark doo doo doo doo doo doo
Grandma Shark doo doo doo doo doo doo
Grandma Shark!

Try it online!

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

Jelly, 51 bytes

;“¤⁾ċ»;“¡N³»ẋ6¤;”¶ẋ3;;“ß<Ė»
“þɗ“¡þ"“£H$“æf⁵“æeⱮ»Ç€Y

Try it online!

Jelly isn't the best for string manipulation. Still pretty good.

If you expand out the strings to their ungolfed form, the code looks like this:

;“ Shark”;“ doo”ẋ6¤;“¶”ẋ3;;“ Shark!”
“Baby“Daddy“Mommy“Grandpa“Grandma”Ç€Y

(The string compression was done using user202729's compressor).

;“ Shark”;“ doo”ẋ6¤;“¶”ẋ3;;“ Shark!”   Helper Link; take a string and format it into a stanza
;“ Shark”                              Append " Shark" to the string
         ;                             Join
                  ¤                    Previous links as a single nilad
          “ doo”                       " doo"
                ẋ6                            repeated 6 times
                   ;“¶”                Append a newline
                       ẋ3              Repeat 3 times
                         ;             Append the string
                          ;“ Shark!”   Append " Shark!"
“Baby“Daddy“Mommy“Grandpa“Grandma”Ç€Y  Main link
“Baby“Daddy“Mommy“Grandpa“Grandma”     ["Baby", "Daddy", "Mommy", "Grandpa", "Grandma"]
                                  ǀ   For each of these words, format it into the stanza with that family position
                                    Y  Join by newlines
\$\endgroup\$
2
\$\begingroup\$

PHP, 153 147 bytes

<?php $s='Shark';$d=str_pad('',23,'doo ');foreach(explode(' ','Baby Daddy Mommy Grandpa Grandma')as$a){echo str_repeat("$a $s $d\n",3),"$a $s!\n";}

Thanks to @manatwork for saving 6 bytes by pointing out str_pad('',23'doo '); is shorter than rtrim(str_repeat('doo ',6));

Try it online!

\$\endgroup\$
6
  • \$\begingroup\$ Unfortunately even $d='doo doo doo doo doo doo' is shorter than that rtrim()+str_repeat() combination. :( But fortunately $d=str_pad('',23,'doo ') is even shorter. For more optimization tips, see Tips for golfing in PHP. \$\endgroup\$
    – manatwork
    Feb 18 '19 at 15:33
  • \$\begingroup\$ @manatwork Thanks for pointing that out, I've updated the post to reflect \$\endgroup\$ Feb 18 '19 at 16:17
  • 1
    \$\begingroup\$ In meantime found some time to play a bit more: Try it online! \$\endgroup\$
    – manatwork
    Feb 18 '19 at 16:44
  • \$\begingroup\$ 113 bytes. Welcome to PPCG! \$\endgroup\$
    – Shaggy
    Feb 18 '19 at 23:44
  • 2
    \$\begingroup\$ 109 bytes \$\endgroup\$
    – Shaggy
    Feb 18 '19 at 23:53
2
\$\begingroup\$

Javascript, 125 123 bytes

['Baby','Daddy','Mommy','Grandpa','Grandma'].flatMap(x=>[...[,,,].fill(' doo'.repeat(6)),'!'].map(y=>x+' Shark'+y)).join`
`

Try it online!

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

JavaScript (134 126 bytes)

-2 bytes thanks to Stephen! -6 bytes thanks to mgthomas99!

["Baby","Daddy","Mommy","Grandma","Grandpa"].forEach(a=>console.log((a+" shark"+" doo".repeat(6)+"\n").repeat(3)+a+" Shark!"))

JS Fiddle

\$\endgroup\$
5
  • \$\begingroup\$ Can save two bytes: a + " -> a+" \$\endgroup\$
    – Stephen
    Feb 18 '19 at 16:36
  • \$\begingroup\$ Wow I was working on a JS solution and barely managed to get to 170 bytes. Your use of repeat is genius! \$\endgroup\$ Feb 18 '19 at 22:51
  • 1
    \$\begingroup\$ You can save 2 bytes by removing the parentheses around the arrow function parameters (so that (a)=> becomes a=>). You can save another 2 bytes by removing the braces around the arrow function body. I'm also not certain you need the explicit newline at the end of the console.log statement, and removing that should save you another 2 bytes. \$\endgroup\$
    – mgthomas99
    Feb 19 '19 at 9:53
  • \$\begingroup\$ The first shark should be capitalised \$\endgroup\$
    – Jo King
    Mar 22 '19 at 5:26
  • \$\begingroup\$ You can save 1 byte by converting the array to a single string with separator characters, and then splitting on those separator characters, and another 4 bytes by changing forEach to map (if you run directly in console, it could print out the return of the map, which is an array of undefined's, but if you run from a file, it doesn't print out that array) "Baby|Daddy|Mommy|Grandma|Grandpa".split`|`.map(a=>console.log((a+" shark"+" doo".repeat(6)+"\n").repeat(3)+a+" Shark!")) \$\endgroup\$ Dec 16 '20 at 3:55
2
\$\begingroup\$

Kotlin 121 bytes

"Baby Daddy Mommy Grandpa Grandma".split(" ").map{(println(("${"$it Shark${" doo".repeat(6)}\n".repeat(3)}$it Shark!")))}


Try it online!

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

Farm, 1157 897 bytes

-260 bytes: apparently only cock a doodle doo needs spaces..

No sharks on my farm:

cock a doodle doomoocotmoobzzcoucoumewmewmewmewmewmewmewgobblehihihimoopiuarfarfarfarfarfarfarfrouuuleomoopiumoosquealhihihimewmooleoarfarfarfrouuuleomoomoocotmoopiuarfarfarfmooleoarfarfarfarfmoomoocoucouarfarfarfssscoinsssgruntcoinblatcoinssscoinblatcoinssscoinblatmoosssgruntmooblatarfarfarfarfarfarfsssmoogruntmoogruntmoogruntgruntcoincoincoinmewblatmoosssmooblatmoosssmooblatcoinmewblatcoinsssgruntcoinblatcoinssscoinblatcoinssscoinblatmoosssgruntmooblatcotarfgruntsssmewblatmoosssmooblatmoogobblesquealmewmoopiuarfmoopiumooroararfmooarfarfarfarfarfarfarfarfarfarfmoohihihimooarfarfmooarfarfarfmoopiumoosssmewmooarfcoinblatroararfarfarfmoomoohihihimooleoarfarfrouuuleomooleomooleoarfarfmooarfarfarfarfarfarfarfarfarfmoomoohihihipiumooleoarfarfarfmoopiuarfarfarfmoomewmoopiumooleoarfarfarfarfarfmooroararfarfarfarfarfarfmooarfarfarfarfarfarfarfarfarfarfmoohihihimoomewmewmewsssmooblathihihihowl

Try it online!


†: Could be 9 less by using cocorico over cock a doodle doo..

\$\endgroup\$
3
  • \$\begingroup\$ Why not use cocorico then :P \$\endgroup\$
    – ASCII-only
    Feb 22 '19 at 14:16
  • 1
    \$\begingroup\$ @ASCII-only: Because I found the language by searching doo on esolangs, lol \$\endgroup\$ Feb 22 '19 at 14:17
  • 1
    \$\begingroup\$ The self-graduating add-on for PPCG leaderboard thinks that this is 1 byte. Can you change the <sup>1</sup> to <sup>see bottom</sup> \$\endgroup\$
    – MilkyWay90
    Jun 5 '19 at 22:01
1
\$\begingroup\$

Attache, 79 bytes

$Baby'$Daddy'$Mommy'$Grandpa'$Grandma+" Shark":>Print@{(_+" doo"*6+lf)*3+_+"!"}

Try it online!

An attempt at compressing the above iteration array is NTS@N=>Split[S@FromBase[Ords@")!-ZOW]NE.kK3(*F(a3\\z6fXD_\\yEM"-32,95],"00"], which is significantly longer than the trivial encoding above. Compressing the string using base conversion in its entirety would likely come out to be longer.

Alternatives

81 bytes: Print@{(_+" doo"*6+lf)*3+_+"!"}=>($Baby'$Daddy'$Mommy'$Grandpa'$Grandma+" Shark")

82 bytes: Output!{(_+" doo"*6+lf)*3+_+"!"}=>($Baby'$Daddy'$Mommy'$Grandpa'$Grandma+" Shark")

86 bytes: Output!(""'3&(" doo"*6+lf)'"!")&Join=>($Baby'$Daddy'$Mommy'$Grandpa'$Grandma+" Shark")

87 bytes: Output!(""'3&(" doo"*6+lf)'"!")&Join@`+&" Shark"=>$Baby'$Daddy'$Mommy'$Grandpa'$Grandma

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

J, 85 bytes

echo('Shark'(,&'!',~(24$' doo')(3#,:)@,~])@,~]);.2'Baby Daddy Mommy Grandpa Grandma '

Try it online!

Note: This assumes a blank line between stanzas is ok. If that's not the case, prepending ,/ to my solution for +2 bytes.

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

Perl 5, 84 bytes

print (map{join(" doo"x6,("\n$_ Shark")x4),"!"}qw(Baby Daddy Mommy Grandpa Grandma))

Try it online!

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

Clean, 134 bytes

import StdEnv,Text
r=repeatn
f=join"\n"[e+" Shark"+concat s\\e<-split" ""Baby Daddy Mommy Grandpa Grandma",s<-r 3(r 6" doo")++[["!"]]]

Try it online!

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

VBA (Excel), 152 118 bytes

-34 bytes. Thanks @TaylorScott

Using Immediate Window.

a=Split("Baby Daddy Mommy Grandpa Grandma"):b=" Shark":c=" doo":For d=0To 19:?a(Int(d/4))b &IIf((d+1)Mod 4=0,"!",Join(Split(String$(6,"."),"."),c)):Next

a=Split("Baby Daddy Mommy Grandpa Grandma"):b=" Shark":For d=0To 19:?a(d\4)b;IIf((d+1)Mod 4,[Rept(" doo",6)],"!"):Next
\$\endgroup\$
3
  • 1
    \$\begingroup\$ You should use integer division instead of casting an int over division - so Int(d/4) goes to d\4 , you can rearrange the arguements of the IIf statement to get rid of the =0 and then you can convert that really nifty join split statement with a Rept statement. All together this becomes a=Split("Baby Daddy Mommy Grandpa Grandma"):b=" Shark":For d=0To 19:?a(d\4)b;IIf((d+1)Mod 4,[Rept(" doo",6)],"!"):Next for 118 Bytes \$\endgroup\$ Feb 18 '19 at 22:03
  • \$\begingroup\$ Totally forgot Rept function lol. Your answer is way better than mine you should've post it as your own answer. Anyways, thanks for cutting off huge bytes to my wall of code. lol. d\4 <-- Didn't know this until now. Thanks! :D \$\endgroup\$
    – remoel
    Feb 19 '19 at 4:48
  • 1
    \$\begingroup\$ I get far more joy out of helping others get better with VBA, than I do writing it myself - Cheers \$\endgroup\$ Feb 19 '19 at 21:54
1
\$\begingroup\$

F# (.NET Core), 179 bytes

["Baby";"Daddy";"Mommy";"Grandpa";"Grandma"]|>Seq.map(fun i->([0..2]|>Seq.map(fun _->i+" Shark doo doo doo doo doo doo")|>String.concat "\n")+"\n"+i+" Shark!")|>String.concat "\n"

Try it online!

No input, export to a string and to std output in a console.

145 bytes

for i in["Baby";"Daddy";"Mommy";"Grandpa";"Grandma"]do(for _ in[0..2]do printfn"%s"(i+" Shark doo doo doo doo doo doo"));printfn"%s"(i+" Shark!")

Try it online!

No input, export to std output

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

F# (.NET Core), 160 156 bytes

let c,r,s=String.concat,List.replicate," Shark"
let p n=r 3(c" "(n+s::r 6"doo"))@[n+s+"!"]
["Baby";"Daddy";"Mommy";"Grandpa";"Grandma"]|>Seq.collect p|>c"
"

Try it online!

And based on @aloisdg version, I get this one:

F# (.NET Core), 130 129 bytes

let p,d=printfn"%s Shark%s"," doo doo"
for i in["Baby";"Daddy";"Mommy";"Grandpa";"Grandma"]do(for _ in"123"do p i (d+d+d));p i"!"

Try it online!

Gaining 1 more char by changine [0..2] by "123" wich is also a sequence of 3 items...

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

groovy, 96 bytes

'Baby Daddy Mommy Grandpa Grandma'.split().any{n="$it Shark";println((n+" doo"*6+'\n')*3+n+'!')}

Try it online!

\$\endgroup\$
3
  • \$\begingroup\$ Protip: esc -> s -> g on the TryItOnline page for a well formatted post \$\endgroup\$
    – ASCII-only
    Feb 19 '19 at 22:37
  • \$\begingroup\$ close \$\endgroup\$
    – ASCII-only
    Feb 20 '19 at 0:06
  • \$\begingroup\$ also close \$\endgroup\$
    – ASCII-only
    Feb 20 '19 at 1:17
1
\$\begingroup\$

T-SQL, 151 bytes

SELECT REPLACE(a.value+' Shark'+b.value,'Q',REPLICATE(' doo',6))
FROM STRING_SPLIT('Baby,Daddy,Mommy,Grandpa,Grandma',',')a,STRING_SPLIT('Q,Q,Q,!',',')b

Line break for readability only.

SQL's built-in function names are annoyingly long.

STRING_SPLIT works in SQL 2016 and later.

Order isn't 100% guaranteed without an ORDER BY, but this seemed to work in my testing.

\$\endgroup\$
2
  • \$\begingroup\$ It seems sql answers are not popular, very nice answer. Which means a lot comming from me \$\endgroup\$ Apr 4 '19 at 21:31
  • \$\begingroup\$ Thanks, @t-clausen.dk! \$\endgroup\$
    – BradC
    Apr 4 '19 at 22:00
1
\$\begingroup\$

brainfuck, 627 593 573 bytes

Initialise Array with "Baby\0Daddy\0Mommy\0Grandpa\0Grandma"
Loop runs 71 times
++[++++++++++++++++++
    Get array cells to approximately correct values
    >>>+>>+++++>>+++++>>-->>>>+>>+++++>>+++++>>+++++>>-->>>>+>>-->>-->>-->>-->>>>+>>-->>+++++>>-->>+++++>>-->>+++++>>>>+>>-->>+++++>>-->>+++++>>-->>+++++
    [[<<]<<]>
]
Finish getting cells to correct values
>>>---->>->>>>++++++++>>+>>-->>->>++>>++>>++++++++>>+>>+++++++>>-->>---->>---->>++++++++>>+>>+>>+>>->>--->>++>>->>->>+>>+>>+>>->>--->>++>>---->>-
Inject ones between each cell in the array
[-<+<]>[>>]+

Initialise an exclamation mark; newline; and the string " Shark"
>>>+++++++++++[+++++++
    >------->+>>+>----->+++>+++>---->+++
    <<<<<<<<<
]
>->-->>--->++>->-------->-->++
[<]
Go to the end of the "Baby" Array to loop
<<<<<<[
    >>>
    Loop 3 times
    +++[-
        Go to the first value of the baby array
        <<<[<<]>>>
        Print the word out
        [.>>]
        Go to the shark array
        >[>>]>>>>>
        Print " Shark"
        [.>]
        <[<]
        Loop 6 times
        ++++++[-
            Print a space
            >.
            Change the 'a' in " Shark" to a 'd' and print
            >>>+++.---
            Change the 'r' in " Shark" to an 'o' and print twice
            >---..+++
            <<<<<
        ]
        Print newline
        <<.
        <
    ]
    Go to start of baby array
    <<<[<<]>>
    Print and consume the first string in the array
    ->[.[-]>->]
    Go to shark string
    >[>>]>>>>>
    Print " Shark"
    [.>]
    <[<]
    Print "!\n"
    <.<.
    <<<<
]

-20B thanks to Jo King

Try it online!

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

Japt -R, 58 57 bytes

`BabysDaddysMommysGÎÀpGÎÀµ`qÅ˱` Srk` +` ºo`³²+R ³+D+'!

Run it online

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

Underload, 93 89 bytes

(Grandma)(Grandpa)(Mommy)(Daddy)(Baby)(~( Shark)*:( doo)::**:**(
)*::**S(!
)*S):^:^:^:^:^

Since Underload is really good at duplicating and concatenation with strings, I decided to give this a go.

Saved 4 bytes by re-arranging things.

Try it online!

Explanation

(Grandma)  Pushes 'Grandma'
(Grandpa)  Pushes 'Grandpa'
(Mommy)  Pushes 'Mommy'
(Daddy)  Pushes 'Daddy'
(Baby)   Pushes 'Baby'
(  Add the next bit of code to the stack
~  Swaps so the name of the Shark (eg: Baby) is on the top of the stack
( Shark)  Pushes ' Shark' to the stack
*  Concatenates ' Shark' to the name of the Shark
:  Duplicates the top of the stack
( doo)  Pushes ' doo'
::**:*  Turns it into ' doo doo doo doo doo doo'
*  Concatenates it to the '[name] Shark'
(<Newline>)*  Concatenates a newline to the string, making it '[Name] Shark doo doo doo doo doo doo[Newline]'
::**   Duplicates it twice
S  Outputs the first three lines of the stanza
(![Newline])*S Concatenates '![Newline]' to the '[Name] Shark' string and prints it
)  Ends the code being added to the stack
:^:^:^:^:  Runs the code in the bracket 5 times, for the 5 different stanzas
\$\endgroup\$
1
\$\begingroup\$

Babylang, 2866 bytes

aaag aaag gagu aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gaga gaga gaga aaag gaga gaga aaag aaag aaag aaag aaag gaga gaga aaag aaag aaag aaag aaag gaga gaga uuug uuug gaga gaga gaga gaga aaag gaga gaga aaag aaag aaag aaag aaag gaga gaga aaag aaag aaag aaag aaag gaga gaga aaag aaag aaag aaag aaag gaga gaga uuug uuug gaga gaga gaga gaga aaag gaga gaga uuug uuug gaga gaga uuug uuug gaga gaga uuug uuug gaga gaga uuug uuug gaga gaga gaga gaga aaag gaga gaga uuug uuug gaga gaga aaag aaag aaag aaag aaag gaga gaga uuug uuug gaga gaga aaag aaag aaag aaag aaag gaga gaga uuug uuug gaga gaga aaag aaag aaag aaag aaag gaga gaga gaga gaga aaag gaga gaga uuug uuug gaga gaga aaag aaag aaag aaag aaag gaga gaga uuug uuug gaga gaga aaag aaag aaag aaag aaag gaga gaga uuug uuug gaga gaga aaag aaag aaag aaag aaag gagu gagu gugu gugu guga gugu gugu guga gaga guga gaga gaga gaga uuug uuug uuug uuug gaga gaga uuug gaga gaga gaga gaga aaag aaag aaag aaag aaag aaag aaag aaag gaga gaga aaag gaga gaga uuug uuug gaga gaga uuug gaga gaga aaag aaag gaga gaga aaag aaag gaga gaga aaag aaag aaag aaag aaag aaag aaag aaag gaga gaga aaag gaga gaga aaag aaag aaag aaag aaag aaag aaag gaga gaga uuug uuug gaga gaga uuug uuug uuug uuug gaga gaga uuug uuug uuug uuug gaga gaga aaag aaag aaag aaag aaag aaag aaag aaag gaga gaga aaag gaga gaga aaag gaga gaga aaag gaga gaga uuug gaga gaga uuug uuug uuug gaga gaga aaag aaag gaga gaga uuug gaga gaga uuug gaga gaga aaag gaga gaga aaag gaga gaga aaag gaga gaga uuug gaga gaga uuug uuug uuug gaga gaga aaag aaag gaga gaga uuug uuug uuug uuug gaga gaga uuug gagu uuug gugu aaag gugu guga gaga gagu gaga gaga guga aaag gaga gaga gaga aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag aaag gagu aaag aaag aaag aaag aaag aaag aaag gaga uuug uuug uuug uuug uuug uuug uuug gaga aaag gaga gaga aaag gaga uuug uuug uuug uuug uuug gaga aaag aaag aaag gaga aaag aaag aaag gaga uuug uuug uuug uuug gaga aaag aaag aaag gugu gugu gugu gugu gugu gugu gugu gugu gugu guga gaga uuug gaga uuug uuug gaga gaga uuug uuug uuug gaga aaag aaag gaga uuug gaga uuug uuug uuug uuug uuug uuug uuug uuug gaga uuug uuug gaga aaag aaag gagu gugu guga gugu gugu gugu gugu gugu gugu gagu gaga gaga gaga aaag aaag aaag gagu uuug gugu gugu gugu gagu gugu gugu guga gaga gaga gaga gagu guuu gaga gaga guga gaga gagu gaga gaga guga gaga gaga gaga gaga gaga gagu guuu gaga guga gugu gagu gugu guga aaag aaag aaag aaag aaag aaag gagu uuug gaga guuu gaga gaga gaga aaag aaag aaag guuu uuug uuug uuug gaga uuug uuug uuug guuu guuu aaag aaag aaag gugu gugu gugu gugu gugu guga gugu gugu guuu gugu guga gugu gugu gugu gagu gugu gugu guga gaga gaga uuug gaga gagu guuu gagu uuug guga gaga uuug gaga guga gaga gagu gaga gaga guga gaga gaga gaga gaga gaga gagu guuu gaga guga gugu gagu gugu guga gugu guuu gugu guuu gugu gugu gugu gugu guga 

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

GolfScript, 70 bytes

"Baby
Daddy
Mommy
Grandpa
Grandma"n/{" Shark"+" doo"6*n++...-25<"!"n}/

Try it online!

Explanation:

"Baby
Daddy
Mommy
Grandpa
Grandma"n/                                       Push shark names, then split by newline
          {                               }/     For each name:
           " Shark"+                                 Concatenate with Shark
                    " doo"6*n++                      add doo * 6 then newline
                               ...                   Duplicate line 3 more times
                                  -25<               Cut off the "doo"s
                                      "!"n           Add "!"
\$\endgroup\$
1
\$\begingroup\$

Rockstar, 151 bytes

Need to figure out a way to loop over the names that's cheaper than having a separate function call for each.

F takes S
let L be S+" Shark"+" doo"*6+"
"
say L*3+S+" Shark!"

F taking "Baby"
F taking "Daddy"
F taking "Mommy"
F taking "Grandpa"
F taking "Grandma"

Try it here (Code will need to be pasted in)

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

Befunge-93, 527 bytes

vv          <<
3v       v,<           v   v     v
0>" ybaB">:| p
<v         <^6#
         v,< 1
>>"krahS">:| "
 v06$      <0<v,,"!"*25
        v,<>^"$v       <
 >"ood ">:|^_^3         v,<
 ^0_v#:-1$< : \>" yddaD">:|
^   >$52*,1-^ "^0$ <      >
^             v     v      < v,<>
>">":62*1p62*#"1+1p^>" ymmoM">:|
^p-1:*27"1"p61<     0    >     >^
v p1-1*46">"p6<     $     v      <v,<
>"6"72*:p    #p     ^     >"dnarG">:|
v     p1*39">"<          ^  ,,,"pa "<
>"v"72*82*p            >$0^
v   p*28*48"m"<
>"@"72*6p              ^

Try it online!

I didn't really try to golf it much, I just wanted it to work. It does, and I'm pretty proud of it. I used the "p" command heavily to reuse a lot of code.

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

Vyxal, 48 bytes

`÷Ċ ₈Ȧ Mummy ∆ƛpa ∆ƛma`⌈` Ẏ꘍`+ƛ3(` doo`6*+,)\!+,

Try it Online!

A mess.

`...`⌈                         # Names, split on newlines
      `...`+                   # Append ' Shark' to each
            ƛ                  # Foreach...
             3(          )     # Three times
               ` doo`6*+,      # Append six doos and output
                          \!+, # Append a ! and output
\$\endgroup\$
0
\$\begingroup\$

C (compiled with VC++ (Visual Studio 2017)) 536Bytes

#include "stdafx.h"
#define d "doo "
#define p(x) printf(x);
#define n p("\n")
#define b p(f[i])p(" Shark ")
#define l(x,y) for(int x=0;x<y;x++)
void main(){const char*f[]={"Baby","Daddy","Mommy","Grandpa","Grandma"};l(i,5){l(k,3){b;l(j,6)p(d)n}b;p("\b!\n")}}

this is my naive try: it started from the "good version" where everything is done the neat and tidy way and i just removed the blanks, semicolons where possible and curly braces if possible. i changed main from int to void in order to be able to leave out the return Statement in the end if using a different Compiler (say gcc) the stdafx.h can be ommitted (visual Studio throws an error though (or i just dont know how to do it better...)) although then the use of printf means you either have to include stdio.h instead (=1byte win) or you have to use a Compiler flag to add this to the build path although not mentioned in the Code.... if its no dealbreaker if the exclamation mark is one space away from Baby Shark then the \b can be ommitted (=2 Byte win)

\$\endgroup\$
3
  • \$\begingroup\$ removing the space between include and " makes a 1byte win. and removing the space between ) and for makes another Maybe you can squeeze out a bit more by modifing the l makro to make curly braces and therefor take one Argument more (=the loopbody) \$\endgroup\$
    – der bender
    Feb 17 '19 at 22:26
  • \$\begingroup\$ Would also work with a non const char array, no? \$\endgroup\$
    – B. Go
    Apr 5 '19 at 15:41
  • \$\begingroup\$ i used to compile that with visual studio and that throws an error if not. maybe other compilers aint that strict \$\endgroup\$
    – der bender
    Apr 5 '19 at 15:43
0
\$\begingroup\$

Wolfram Language (Mathematica), 145 bytes

Nothing special, still thinking of a shorter method.

a={"Baby","Daddy","Mommy","Grandpa","Grandma"};c=" Shark";b=c<>StringJoin@Table[" doo",6];Do[Do[Print[a[[i]]<>b],3];Print[a[[i]]<>c<>"!"];,{i,5}]

Try it online!

\$\endgroup\$
10
  • \$\begingroup\$ 141? \$\endgroup\$
    – ASCII-only
    Feb 19 '19 at 8:42
  • \$\begingroup\$ 137? \$\endgroup\$
    – ASCII-only
    Feb 19 '19 at 8:46
  • 1
    \$\begingroup\$ 95? \$\endgroup\$
    – ASCII-only
    Feb 19 '19 at 12:15
  • 2
    \$\begingroup\$ also 95 but stolen from Haskell answer \$\endgroup\$
    – ASCII-only
    Feb 19 '19 at 12:37
  • 1
    \$\begingroup\$ @ASCII-only nice improvements. I think that you can take credit for those though, you went a long way from where I started! \$\endgroup\$
    – Kai
    Feb 19 '19 at 15:58

Your Answer

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

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