74
\$\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\$
  • 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
  • 6
    \$\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
  • 2
    \$\begingroup\$ "doo doo doo doo doo doo" is really over-simplified. \$\endgroup\$ – R.. GitHub STOP HELPING ICE Feb 17 '19 at 23:54
  • 27
    \$\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

64 Answers 64

2
\$\begingroup\$

Stax, 43 bytes

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

Run and debug it

| improve this answer | |
\$\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!

| improve this answer | |
\$\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
| improve this answer | |
\$\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!

| improve this answer | |
\$\endgroup\$
  • \$\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\$ – EvanBarbour3 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\$

Farm, 1157 8971 bytes

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

No sharks on my farm:

cock a doodle doomoocotmoobzzcoucoumewmewmewmewmewmewmewgobblehihihimoopiuarfarfarfarfarfarfarfrouuuleomoopiumoosquealhihihimewmooleoarfarfarfrouuuleomoomoocotmoopiuarfarfarfmooleoarfarfarfarfmoomoocoucouarfarfarfssscoinsssgruntcoinblatcoinssscoinblatcoinssscoinblatmoosssgruntmooblatarfarfarfarfarfarfsssmoogruntmoogruntmoogruntgruntcoincoincoinmewblatmoosssmooblatmoosssmooblatcoinmewblatcoinsssgruntcoinblatcoinssscoinblatcoinssscoinblatmoosssgruntmooblatcotarfgruntsssmewblatmoosssmooblatmoogobblesquealmewmoopiuarfmoopiumooroararfmooarfarfarfarfarfarfarfarfarfarfmoohihihimooarfarfmooarfarfarfmoopiumoosssmewmooarfcoinblatroararfarfarfmoomoohihihimooleoarfarfrouuuleomooleomooleoarfarfmooarfarfarfarfarfarfarfarfarfmoomoohihihipiumooleoarfarfarfmoopiuarfarfarfmoomewmoopiumooleoarfarfarfarfarfmooroararfarfarfarfarfarfmooarfarfarfarfarfarfarfarfarfarfmoohihihimoomewmewmewsssmooblathihihihowl

Try it online!


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

| improve this answer | |
\$\endgroup\$
  • \$\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
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!

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

Jelly, 42 bytes

“¡N³»ẋ6Wẋ3;”!ṭ€;Y
“¡ʂɓṙṢ®ÑR+£ṭỤṙ»Ḳ瀓¤⁾ċ»Y

Try it online!

How?

“¡N³»ẋ6Wẋ3;”!ṭ€;Y - Link 1: make a verse: familyMember; space+animalName
                  -                        e.g. "Baby"; " Shark"
“¡N³»             - dictionary word " doo"
     ẋ6           - repeat 6 times -> " doo doo doo doo doo doo"
       W          - wrap in a list -> [" doo d..."]
        ẋ3        - repeat 3 times -> [" doo d..."," doo d..."," doo d..."]
           ”!     - literal '!' character
          ;       - concatenate    -> [" doo d..."," doo d..."," doo d...","!"]
               ;  - concatenate inputs ["Baby Shark"]
             ṭ€   - tack for €ach  -> [["Baby Shark"," doo d..."],...,["Baby Shark","!"]]
                Y - join with newline characters
 
“¡ʂɓṙṢ®ÑR+£ṭỤṙ»Ḳ瀓¤⁾ċ»Y - Main Link: no arguments
“¡ʂɓṙṢ®ÑR+£ṭỤṙ»          - dictionary words "Baby"+" Daddy"+" Mommy"+" Grandpa"+" Grandma"
               Ḳ         - split at spaces -> ["Baby","Daddy","Mommy","Grandpa","Grandma"]
                  “¤⁾ċ»  - dictionary word " Shark"
                ç€       - call last Link (1) as a dyad for €ach
                       Y - join with newline characters
                         - implicit print
| improve this answer | |
\$\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

| improve this answer | |
\$\endgroup\$
  • \$\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\$ – Matthew Ludwig 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
2
\$\begingroup\$

05AB1E, 39 38 bytes

”‡ÍÊТ×myîºpaîºma”#„o€·À6×3и'!ª”㢔ìâ»

Try it online!

”‡ÍÊТ×myîºpaîºma”                # compressed string "Baby Daddy Mommy Grandpa Grandma"
                  #               # split on spaces
„o€·                              # dictionary string "o do"
    À                             # rotated left: " doo"
     6×                           # string-repeat 6 times: " doo doo doo doo doo doo"
       3и                         # list-repeat 3 times
         '!ª                      # append "!" to that list
            ”ã¢”ì                 # prepend "Shark" to each element of that list
â                                 # cartesian product
 »                                # join by newlines
                                  # implicit output
| improve this answer | |
\$\endgroup\$
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!

| improve this answer | |
\$\endgroup\$
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

| improve this answer | |
\$\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.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Perl 5, 84 bytes

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

Try it online!

| improve this answer | |
\$\endgroup\$
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!

| improve this answer | |
\$\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
| improve this answer | |
\$\endgroup\$
  • 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\$ – Taylor Scott 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\$ – Taylor Scott 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

| improve this answer | |
\$\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...

| improve this answer | |
\$\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!

| improve this answer | |
\$\endgroup\$
  • \$\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.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ It seems sql answers are not popular, very nice answer. Which means a lot comming from me \$\endgroup\$ – t-clausen.dk 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!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Japt -R, 58 57 bytes

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

Run it online

| improve this answer | |
\$\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
| improve this answer | |
\$\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 

| improve this answer | |
\$\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 "!"
| improve this answer | |
\$\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)

| improve this answer | |
\$\endgroup\$
  • \$\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!

| improve this answer | |
\$\endgroup\$
  • \$\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
0
\$\begingroup\$

Emacs Lisp, 177 bytes

(defmacro w()`(princ(concat i" Shark doo doo doo doo doo doo\n")))
(defmacro z()`(princ(concat i" Shark!\n")))
(loop for i in'("Baby""Daddy""Mommy""Grandpa")do(and(w)(w)(w)(z)))
| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

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

"Baby Daddy Mommy Grandpa Grandma".Split().ToList().ForEach(x=>{string a=" doo",m=x+$" Shark{a+a+a+a+a+a}\n";Write(m+m+m+x+" Shark!\n");});

Try it online!

Any thoughts on improvements? I started aiming for a Linq-based solution with a SelectMany but the deferred execution failed me, along with string.join and return x; being quite verbose syntax

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

Swift 4, 149 bytes

var s=" Shark";for i in["Baby","Daddy","Mommy","Grandpa","Grandma"]{for _ in 0...2{print(i+s+(0..<6).map({_ in" doo"}).reduce("",+))};print(i+s+"!")}

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ 126 \$\endgroup\$ – ASCII-only Feb 20 '19 at 3:53
  • \$\begingroup\$ 119 \$\endgroup\$ – ASCII-only Feb 20 '19 at 4:02
0
\$\begingroup\$

Wolfram Language (Mathematica), 95 bytes

Do[Print[a," Shark"<>If[i>3,"!",Table[" doo",6]]],{a,{Baby,Daddy,Mommy,Grandpa,Grandma}},{i,4}]

Try it online!

| improve this answer | |
\$\endgroup\$

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.