[Question]
  [
The text of the children's book [*Polar Bear, Polar Bear, What Do You Hear?*](http://www.eric-carle.com/ECbooks.html#anchor009) has a very simple pattern. You might use the text to teach introductory programming concepts.
My son was quickly bored by this idea, so I decided to play some golf with it instead.
## The Challenge
In your programming language of choice, write the smallest program possible which will print the following text. Output should match exactly, including case, spacing, and punctuation.
```
Polar Bear, Polar Bear, what do you hear?
I hear a lion roaring in my ear.
Lion, Lion, what do you hear?
I hear a hippopotamus snorting in my ear.
Hippopotamus, Hippopotamus, what do you hear?
I hear a flamingo fluting in my ear.
Flamingo, Flamingo, what do you hear?
I hear a zebra braying in my ear.
Zebra, Zebra, what do you hear?
I hear a boa constrictor hissing in my ear.
Boa Constrictor, Boa Constrictor, what do you hear?
I hear an elephant trumpeting in my ear.
Elephant, Elephant, what do you hear?
I hear a leopard snarling in my ear.
Leopard, Leopard, what do you hear?
I hear a peacock yelping in my ear.
Peacock, Peacock, what do you hear?
I hear a walrus bellowing in my ear.
Walrus, Walrus, what do you hear?
I hear a zookeeper whistling in my ear.
Zookeeper, Zookeeper, what do you hear?
I hear children...
...growling like a polar bear,
roaring like a lion,
snorting like a hippopotamus,
fluting like a flamingo,
braying like a zebra,
hissing like a boa constrictor,
trumpeting like an elephant,
snarling like a leopard,
yelping like a peacock,
bellowing like a walrus...
that's what I hear.
```
  
[Answer]
## 05AB1E, ~~349~~ ~~331~~ ~~330~~ ~~322~~ ~~314~~ 311 bytes
```
•4i;kV_†©:š×Îj€Yå—‚‘%˜ESÎ´þ¤çÑ9¶‹{Å€7¾à{Ì®qA•35B0¡…ing«lV•7ü[¿‘¢wÀ¶à-‚¤î„jHâ™ÐJ'µ‡ÀÂý6›ü‚š¸€%NtÅýµL›fU¥ì€€uîT¡›Ÿ{!œ>'Ì&ý§¨Ü?é>•36B1ð:0¡™D©„, «D‚ø“€À€·€î—«?“¶«¸â€˜€JU¦“„¾“‚˜lv„I “—«0€†€¯¶å.“«0¡`yð«Y¦õ‚˜Nè«sr„ aN5Qi'n«}ð«N9›ijrj¨ðs«…...«}srJˆ}X¯‚ø€Jvy,¶?}…...DU?Y¨vN__i',¶}yð“€è€…“N6Qi'n«}ð®NèJl?}X,“€Š's€À I—«.“?
```
[Try it online](http://05ab1e.tryitonline.net/#code=4oCiNGk7a1Zf4oCgwqk6xaHDl8OOauKCrFnDpeKAlOKAmuKAmCXLnEVTw47CtMO-wqTDp8OROcK24oC5e8OF4oKsN8K-w6B7w4zCrnFB4oCiMzVCMMKh4oCmaW5nwqtsVuKAojfDvFvCv-KAmMKid8OAwrbDoC3igJrCpMOu4oCeakjDouKEosOQSifCteKAocOAw4LDvTbigLrDvOKAmsWhwrjigqwlTnTDhcO9wrVM4oC6ZlXCpcOs4oKs4oKsdcOuVMKh4oC6xbh7IcWTPifDjCbDvcKnwqjDnD_DqT7igKIzNkIxw7A6MMKh4oSiRMKp4oCeLCDCq0TigJrDuOKAnOKCrMOA4oKswrfigqzDruKAlMKrP-KAnMK2wqvCuMOi4oKsy5zigqxKVcKm4oCc4oCewr7igJzigJrLnGx24oCeSSDigJzigJTCqzDigqzigKDigqzCr8K2w6Uu4oCcwqswwqFgecOwwqtZwqbDteKAmsucTsOowqtzcuKAniBhTjVRaSduwqt9w7DCq0454oC6aWpyasKow7BzwqvigKYuLi7Cq31zckrLhn1Ywq_igJrDuOKCrEp2eSzCtj994oCmLi4uRFU_WcKodk5fX2knLMK2fXnDsOKAnOKCrMOo4oKs4oCm4oCcTjZRaSduwqt9w7DCrk7DqEpsP31YLOKAnOKCrMWgJ3PigqzDgCBJ4oCUwqsu4oCcPw&input=)
**Explanation**
`•4i;kV_†©:š×Îj€Yå—‚‘%˜ESÎ´þ¤çÑ9¶‹{Å€7¾à{Ì®qA•`  
Packed string containing the sounds `GROWL0ROAR0SNORT0FLUT0BRAY0HISS0TRUMPET0SNARL0YELP0BELLOW0WHISTL`
`35B0¡…ing«lV`  
Unpack, split on 0, add "ing" to each word, convert to lower and store in variable Y
`•7ü[¿‘¢wÀ¶à-‚¤î„jHâ™ÐJ'µ‡ÀÂý6›ü‚š¸€%NtÅýµL›fU¥ì€€uîT¡›Ÿ{!œ>'Ì&ý§¨Ü?é>•`  
Packed string containing the animals `POLAR1BEAR0LION0HIPPOPOTAMUS0FLAMINGO0ZEBRA0BOA1CONSTRICTOR0ELEPHANT0LEOPARD0PEACOCK0WALRUS0ZOOKEEPER`
`36B1ð:0¡™`  
Unpack, replace 1 with space, split on 0 and convert to title case
`D©„, «D‚ø`  
Duplicate, save to register for later use, add ", " to one copy, duplicate that and zip.
`“€À€·€î—«?“¶«¸`  
Dictionary words "what do you hear?", followed by a new line, added to a new list
`â€˜€JU`  
Cartesian product of list of "Animal, Animal, " and "what do you hear?\n", flattened and joined and stores it in variable X.
Pruduces list of strings of the form "Animal, Animal, what do you hear?n".
`¦“„¾“‚˜l`  
Take the remaining list of animals from before, remove the zookeeper and add children, convert to lower case.
`v`  
For each animal:
```
„I “—«0€†€¯¶å.“«0¡`
```
Push "I hear0 in my ear.", split on 0 and push as separate strings.
`yð«Y¦õ‚˜Nè«`  
Push "animal sound" with children having no sound
`sr„ a`  
Push "a" in correct place
`N5Qi'n«}`  
If the animal is "Elephant" add "n"
`ð«`  
Add space.
`N9›ijrj¨ðs«…...«}`  
If animal is children, remove space and add "..."
`srJˆ}`  
Join the sentence "I hear a(n) animal sound in my ear." (as well as the children one), store in global array and end loop
`X¯‚ø€J`  
Retrieve the first lines, zip and join producing the first part of the rhyme "Animal, Animal, what do you hear?\nI hear a(n) animal sound in my ear."
`vy,¶?}`  
Print followed by new line.
`…...DU?`  
Print "..." and store a copy in variable X.
`Y¨v`  
For each sound except "whistling":
N\_\_i',¶}
For each line except the first one, start it with ",\n" (making the comma go on previous line)
`yð“€è€…“`  
Push sound, space and "like a"
`N6Qi'n«}`  
If Elephant add "n".
`ð®NèJl?}X,`  
Retrieve the animal saved in register, join everything, print and end loop followed by "...".
This produces the "sound like a(n) animal," lines.
`“€Š's€À I—«.“?`  
Print dictionary string "that's what I hear."
[Answer]
# PHP, ~~420~~ ~~414~~ ~~434~~ ~~414~~ 412 bytes
call from CLI or prepend `<pre>` to output.
```
$v=[growl,roar,snort,flut,bray,hiss,trumpet,snarl,yelp,bellow,whistl];$a[6]=n;foreach($n=['polar bear',lion,hippopotamus,flamingo,zebra,'boa constrictor',elephant,leopard,peacock,walrus,zookeeper]as$i=>$p)echo$i?"I hear a$a[$i] $p $v[$i]ing in my ear.
":"",$q=ucwords($p),", $q, what do you hear?
",$i>9?"I hear children...
...":""&$z[]="$v[$i]ing like a$a[$i] $p";echo join(",
",$z),"...
that's what I hear.";
```
* a couple of notices for undefined constants; PHP´s implicit cast to literal string kicks in again
* adding the "n" for "an elephant" took 20 bytes ... hmpf.
* got the 20 bytes back by reordering stuff :)
**breakdown**
```
$n=['polar bear',lion,hippopotamus,flamingo,zebra,'boa constrictor',elephant,leopard,peacock,walrus,zookeeper];
$v=[growl,roar,snort,flut,bray,hiss,trumpet,snarl,yelp,bellow,whistl];
$a[6]=n;
// loop through nouns with index $i
foreach($n as$i=>$p) echo
    // print first part:
        // not first noun: print second line to previous step
        $i?"I hear a$a[$i] $p $v[$i]ing in my ear.\n\n":"",
        // uppercase the first letter of each word in the noun, print
        $q=ucwords($p),
        // print uppercase noun again and the rest of the line
        ", $q, what do you hear?\n",
        // for last noun print bridge, else print nothing
        $i>9?"I hear children...\n\n...":""
    // ... AND add line to second part
        &$z[]="$v[$i]ing like a$a[$i] $p"
;
// print second part and final line
echo join(",\n",$z),"...\nthat's what I hear.";
```
[Answer]
# JavaScript, ~~545~~ ~~541~~ 497 bytes
```
a="Polar Bear|Lion|Hippopotamus|Flamingo|Zebra|Boa Constrictor|Elephant|Leopard|Peacock|Walrus|Zookeeper".split`|`;s=btoa`º0:èj¼ìíÍùn·6ëk,áË3¶»¦¥ës²v«<ÛzYhÃ<!Ëe`.split`z`;a.map((m,n)=>{console.log(m+", "+m+", what do you hear?\n "+((n>9)?"I hear children...\n":"I hear a"+(n==5?"n ":" ")+a[n+1].toLowerCase()+" "+s[n+1]+"ing in my ear.\n"))});p="...";a.map((m,n)=>{if(n>9)return;p+=s[n]+"ing like a"+(n==6?"n ":" ")+m.toLowerCase()+(n>8?"...\nthat's what I hear.":",\n")});console.log(p)
```
Quite a fun challenge!
Thanks Downgoat for saving me ~~27~~ a ton of bytes using `atob`, and Titus for 4 bytes!
Ungolfed:
```
a="Polar Bear|Lion|Hippopotamus|Flamingo|Zebra|Boa Constrictor|Elephant|Leopard|Peacock|Walrus|Zookeeper".split`|`;
s=btoa`º0:èj¼ìíÍùn·6ëk,áË3¶»¦¥ës²v«<ÛzYhÃ<!Ëe`.split`z`;
a.map((m,n)=>{
  console.log(m+", "+m+", what do you hear?\n "+((n==10)?"I hear children...\n":"I hear a" + (n==5?"n ":" ") + a[n+1].toLowerCase() + " " + s[n+1] + "ing in my ear.\n"))
});
p="...";a.map((m,n)=>{
  if(n==10) return;
  p+=s[n] + "ing like a" + (n==6?"n ":" ") + m.toLowerCase() + (n==9?"...\nthat's what I hear.":",\n")
});
console.log(p);
```
[Answer]
# [///](https://esolangs.org/wiki////), ~~523~~ 512 bytes
```
/_/\/\///:/ar_!/, what do you he:?
I he: _$/!a_#/ing in my e:.
_%/ing like a_&/, _*/,
_0/Pol: Be:_1/ion_2/ippopotamus_3/lamingo_4/ebra_5/oa _S/onstrictor_6/lephant_7/eopard_8/eacock_9/alrus_Q/ookeeper_R/trumpet/0&0$ l1 ro:#L1&L1$ h2 snort#H2&H2$ f3 flut#F3&F3$ z4 bray#Z4&Z4$ b5cS hiss#B5CS&B5CS$n e6 R#E6&E6$ l7 snarl#L7&L7$ p8 yelp#P8&P8$ w9 bellow#W9&W9$ zQ whistl#ZQ&ZQ!children...
...growl% pol: be:*ro:% l1*snort% h2*flut% f3*bray% z4*hiss% b5cS*R%n e6*snarl% l7*yelp% p8*bellow% w9...
that's what I he:.
```
[Try it online!](//slashes.tryitonline.net/#code=L18vXC9cLy8vOi9hcl8hLywgd2hhdCBkbyB5b3UgaGU6PwpJIGhlOiBfJC8hYV8jL2luZyBpbiBteSBlOi4KCl8lL2luZyBsaWtlIGFfJi8sIF8qLywKXzAvUG9sOiBCZTpfMS9pb25fMi9pcHBvcG90YW11c18zL2xhbWluZ29fNC9lYnJhXzUvb2EgX1Mvb25zdHJpY3Rvcl82L2xlcGhhbnRfNy9lb3BhcmRfOC9lYWNvY2tfOS9hbHJ1c19RL29va2VlcGVyX1IvdHJ1bXBldC8wJjAkIGwxIHJvOiNMMSZMMSQgaDIgc25vcnQjSDImSDIkIGYzIGZsdXQjRjMmRjMkIHo0IGJyYXkjWjQmWjQkIGI1Y1MgaGlzcyNCNUNTJkI1Q1MkbiBlNiBSI0U2JkU2JCBsNyBzbmFybCNMNyZMNyQgcDggeWVscCNQOCZQOCQgdzkgYmVsbG93I1c5Jlc5JCB6USB3aGlzdGwjWlEmWlEhY2hpbGRyZW4uLi4KCi4uLmdyb3dsJSBwb2w6IGJlOipybzolIGwxKnNub3J0JSBoMipmbHV0JSBmMypicmF5JSB6NCpoaXNzJSBiNWNTKlIlbiBlNipzbmFybCUgbDcqeWVscCUgcDgqYmVsbG93JSB3OS4uLgp0aGF0J3Mgd2hhdCBJIGhlOi4)
608 bytes less than the actual message (1120), this is less than half of it (560)!
[Answer]
# [Dyalog APL](http://goo.gl/9KrKoM), 387 [bytes](http://meta.codegolf.stackexchange.com/a/9429/43319)
```
⎕UCS¯2(219⌶)¯128+⎕UCS'øZýÓÁî°üÁ~`Û¯ß(4Õ+ÖjáïvXô ¶Dhkë ©4¹³`LxÖ4¢gÍ¼4ªBáDÚN¼ùV ÂÅF]@¸hÆà bKÚ¸_oQãÔÝ ¸$8§ú_ÔÈxÖ ~6*ãªd ¿ð>¥ÐB8þôÍxwÄ6Å
ô¡é¢wBlDµ¯ë
Ãbqè+ý+ÜÈýgu!gWËØ#0="«ë"HDÝÀV·¦/ÕMÆí}h<àì7å ÝÒëëñX³ýM <dÄ<ëmµñqP]¥c¬l¾¤ìÚã/$ÝÕqÙÞîCLéMÝÏ}OÔÏ¤r$¤è©~ì2[¢{·YWÒä¿¦à¶)YØ©;s÷¬¥+ó&¿ÉâgËr
,Ýî©)¥Ö­2è´ÝÅd{úK5­·Õ}ýÚ'
```
To ease reading: `⎕UCS¯2(219⌶)¯128+⎕UCS'`...`'`
`⎕UCS '`...`'` convert string to Unicode code points
`¯128+` subtract 128 to get -128 ≤ n ≤ 127
`¯2(219⌶)` un-zlib
`⎕UCS` convert Unicode code points to string
The source string is the following 365 bytes of zlib'ed Unicode code points:
```
F8 5A FD D3 C1 EE 04 B0 8C FC C1 7E 60 DB AF 91 DF 28 34 D5 2B D6 6A E1 EF 15 76 96 58 F4 09 B6 44 11 93 04 68 6B EB A0 A9 94 34 B9 10 98 0F B3 60 4C 78 0C D6 91 1C 34 A2 89 67 CD BC 34 AA 42 95 E1 44 9E DA 4E BC 0B 0F F9 87 85 56 20 83 C2 C5 46 5D 40 B8 68 C6 E0 20 92 62 13 81 89 4B DA B8 5F 9A 6F 51 E3 D4 DD 9F A0 B8 24 38 A7 FA 5F D4 C8 78 7F D6 A0 7E 36 2A E3 AA 64 20 BF F0 3E A5 D0 42 9A 95 38 FE F4 CD 8A 78 99 77 C4 17 89 11 10 36 82 C5 0D 8A 9A F4 A1 12 E9 A2 92 77 9D 42 1E 6C 44 B5 AF EB 0D 04 C3 62 71 87 9C E8 2B FD 2B DC 04 C8 FD 67 75 21 67 57 04 CB D8 23 12 30 9A 3D 22 AB EB 22 48 9E 44 DD C0 56 B7 87 85 A6 2F D5 03 4D 9D C6 ED 7D 1E 68 3C E0 EC 37 9C 94 08 86 E5 09 DD D2 EB EB F1 58 B3 FD 4D 20 04 3C 17 64 C4 3C EB 6D B5 F1 11 89 71 50 5D A5 63 AC 6C 9A BE A4 EC DA E3 2F 24 DD D5 71 D9 DE EE 04 43 4C E9 4D DD CF 7D 4F 13 D4 CF 13 A4 72 24 A4 E8 1A 9E A9 7E EC 1F 32 5B 19 10 A2 7B B7 01 59 57 D2 E4 BF A6 E0 B6 29 94 59 D8 A9 3B 73 1D 94 9B F7 AC A5 2B F3 26 BF C9 E2 67 7F CB 72 0A 2C DD EE A9 29 A5 D6 AD 92 32 E8 B4 DD C5 64 7B FA 8A 4B 35 AD B7 D5 7D 82 0F FD 1 DA
```
[Answer]
# Python 3, ~~497~~ ~~484~~ 480 bytes
```
P=print
N=lambda m:"an"[:("E"==m[0])+1]+" "+m.lower()
h="I hear "
A=[a.split("|")for a in"Polar Bear|growl:Lion|roar:Hippopotamus|snort:Flamingo|flut:Zebra|bray:Boa Constrictor|hiss:Elephant|trumpet:Leopard|snarl:Peacock|yelp:Walrus|bellow:Zookeeper|whistl".split(":")]
for i in range(11):
 a,b=A[i]
 if i:P(h+N(a)+" "+b+"ing in my ear.\n")
 a+=", ";P(a+a+"what do you hear?")
P(h+"children...\n\n..."+",\n".join([z+"ing like "+N(y)for y,z in A[:-1]])+"...\nthat's what I hear.")
```
(Credit for 13 bytes saved should go to Gábor Fekete, and an additional 4 bytes were saved by Taylor Lopez.)
So you could probably guess I was going to use a language like Python as a teaching tool. This was the program before I started golfing it.
```
def startsWithVowel(name):
    firstLetter = name[0]
    return firstLetter in ["A", "E", "I", "O", "U"]
def aOrAn(name):
    return "an" if startsWithVowel(name) else "a"
animals = [
#    NAME (0),     SOUND (1)
    ("Polar Bear", "growling"),
    ("Lion", "roaring"),
    ("Hippopotamus", "snorting"),
    ("Flamingo", "fluting"),
    ("Zebra", "braying"),
    ("Boa Constrictor", "hissing"),
    ("Elephant", "trumpeting"),
    ("Leopard", "snarling"),
    ("Peacock", "yelping"),
    ("Walrus", "bellowing"),
    ("Robot Dragon", "screeching"),
    ("Owl", "hooting"),
    ("Monkey", "laughing"),    
    ("Zookeeper", "whistling")]
NAME = 0
SOUND = 1
for animalNumber in range(len(animals)):
    thisAnimal = animals[animalNumber]
    if animalNumber + 1 < len(animals):    
        nextAnimal = animals[animalNumber + 1] 
    else: 
        nextAnimal = None
    print("{n}, {n}, what do you hear?".format(n=thisAnimal[NAME]))
    if nextAnimal != None:
        print("I hear {a} {n} {s} in my ear.".format(n=nextAnimal[NAME].lower(),
                                                     s=nextAnimal[SOUND],
                                                     a=aOrAn(nextAnimal[NAME])))
    else:
        print("I hear children...")
        children = []        
        for animal in animals[:-1]:
            children.append("{s} like {a} {n}".format(n=animal[NAME].lower(), 
                                                      s=animal[SOUND],
                                                      a=aOrAn(animal[NAME])))
        print("...{}...".format(",\n".join(children)))
        print("that's what I hear.")
```
[Answer]
# Pyth - 427 384 Bytes
```
=G"1, 1, what do you hear?\nI hear a 2 in my ear.\n"=Hc"growling/Polar Bear/roaring/Lion/snorting/Hippopotamus/fluting/Flamingo/braying/Zebra/hissing/Boa Constrictor/trumpeting/Elephant/snarling/Leopard/yelping/Peacock/bellowing/Walrus/whistling/Zookeeper"\/FNT
::G\1@H+yN1\2++r@H+yN3Zd@H+yN2)p+::G"I(.|\n)*"k\1@H20"I hear children...\n\n..."FN9
::"1 like a 2,"\1@HyN\2r@H+yN1Z)p"bellowing like a walrus...\nthat's what I hear.
```
```
J"%s, %s, what do you hear?"K"I hear a%sing in my ear.\n"=Hc"Polar Bear/roar/Lion/snort/Hippopotamus/flut/Flamingo/bray/Zebra/hiss/Boa Constrictor/trumpet/Elephant/snarl/Leopard/yelp/Peacock/bellow/Walrus/whistl/Zookeeper/growl"\/FN11
%J*2[@HyN)?qNT"I hear children...\n"%Kjd[?qN5\nkr@H+yN2Z@HhyN))p"..."FN9
+%=J"%sing like a%s"[@HtyN+?qN5\nk+dr@HyNZ)?qN8"..."\,)
"that's what I hear"
```
Try it here - [permalink](http://pyth.herokuapp.com/?code=J%22%25s%2C+%25s%2C+what+do+you+hear%3F%22K%22I+hear+a%25sing+in+my+ear.%5Cn%22%3DHc%22Polar+Bear%2Froar%2FLion%2Fsnort%2FHippopotamus%2Fflut%2FFlamingo%2Fbray%2FZebra%2Fhiss%2FBoa+Constrictor%2Ftrumpet%2FElephant%2Fsnarl%2FLeopard%2Fyelp%2FPeacock%2Fbellow%2FWalrus%2Fwhistl%2FZookeeper%2Fgrowl%22%5C%2FFN11%0A%25J%2a2%5B%40HyN%29%3FqNT%22I+hear+children...%5Cn%22%25Kjd%5B%3FqN5%5Cnkr%40H%2ByN2Z%40HhyN%29%29p%22...%22FN9%0A%2B%25%3DJ%22%25sing+like+a%25s%22%5B%40HtyN%2B%3FqN5%5Cnk%2Bdr%40HyNZ%29%3FqN8%22...%22%5C%2C%29%0A%22that%27s+what+I+hear%22&debug=0)
[Answer]
# C#, ~~575~~ ~~525~~ ~~520~~ ~~526~~ ~~507~~ ~~504~~ ~~497~~ ~~494~~ 493 bytes
```
()=>{var t="growl,Polar Bear,roar,Lion,snort,Hippopotamus,flut,Flamingo,bray,Zebra,hiss,Boa Constrictor,trumpet,Elephant,snarl,Leopard,yelp,Peacock,bellow,Walrus,whistl,Zookeeper".Split(',');string r="",s="",z="a ",n="an ";for(int i=0,j=0;i<21;r+=t[++i]+$", {t[i]}, what do you hear?\nI hear "+(i>19?@"children...
...":(i==11?n:z)+t[++i+1].ToLower()+$" {t[i]}ing in my ear.\n\n"))s+=j<20?t[j]+"ing like "+(j==12?n:z)+t[++j].ToLower()+(++j<20?@",
":@"...
"):"that's what I hear.";return r+s;};
```
C# lambda where the output is a `string`.
### Explanation
1. Init `t` as a string with the format `noise,animal,noise,animal,...` and split by `,`.
2. Declare `r` and `s`. `r` is the first part of the song and `s` the last part. `z` and `n` are here to handle `Elephant`.
3. Walk `t` and build `r` and `s` in the same loop. Weird ternary+interpolated stuff.
4. Return the first part of the song followed by the last part.
### Code
```
()=>{
    var t="growl,Polar Bear,roar,Lion,snort,Hippopotamus,flut,Flamingo,bray,Zebra,hiss,Boa Constrictor,trumpet,Elephant,snarl,Leopard,yelp,Peacock,bellow,Walrus,whistl,Zookeeper".Split(',');
    string r="",s="",z="a ",n="an ";
    for(int i=0,j=0;i<21;r+=t[++i]+$", {t[i]}, what do you hear?\nI hear "+(i>19?@"children...
...":(i==11?n:z)+t[++i+1].ToLower()+$" {t[i]}ing in my ear.\n\n"))
        s+=j<20?t[j]+"ing like "+(j==12?n:z)+t[++j].ToLower()+(++j<20?@",
":@"...
"):"that's what I hear.";
    return r+s;
};
```
[Try it online!](https://dotnetfiddle.net/mlzBeA)
[Answer]
# Python 2 - 454 bytes
```
a="polar bear,lion,hippopotamus,flamingo,zebra,boa constrictor,elephant,leopard,peacock,walrus,zookeeper,whistl,bellow,yelp,snarl,trumpet,hiss,bray,flut,snort,roar,growl".split(',')
e='...\n\n'
r=range
print'\n'.join([(a[i].title()+', ')*2+"what do you hear?\nI hear "+((i<10)*("a%s %sing in my ear.\n"%("n "[i!=5:]+a[i+1],a[~-~i]))or"children%s..."%e+",\n".join(a[~j]+"ing like a"+"n "[j!=6:]+a[j]for j in r(10))+e+"that's what I hear.")for i in r(11)])
```
[Answer]
# R 518 509 482 477 474 465 452 456 bytes
[Link](http://www.r-fiddle.org/#/fiddle?id=5pqkHPyL&version=2 "Link") to R-Fiddle to try code
```
a=c("Polar Bear","Lion","Hippopotamus","Flamingo","Zebra","Boa Constrictor","Elephant","Leopard","Peacock","Walrus","Zookeeper")
b=c("...growl","roar","snort","flut","bray","hiss","trumpet","snarl","yelp","bellow","whistl")
d=c(rep("a ",6),"an ")
f=tolower(a)
cat(c(paste0(a,", ",a,", what do you hear?\nI hear ",c(paste0(d,f," ",b,"ing in my ear.")[-1],"children..."),"\n\n"),paste0(b,"ing like ",d,f,c(rep(",\n",9),"...\nthat's what I hear."))[-11]))
```
* Moved `children` out of the vector `a`, and got rid of corresponding entry in the `d` vector to save 8 bytes
* More tidying up and removing of subscripts made redundant by moving `children`, saved further 27 bytes.
* Globalised the `tolower` function, saved 5 bytes
* Replace `writeLines` with `cat` and reformatted appropriately (added `\n` in places) saved 3 bytes
* Realised that if `d` is only 7 elements not the full 11, R will just loop back to the start again. As 11 < 14 then this works for us. Saved 9 bytes.
* globalised subscripts, saved 13 bytes.
* `cat` function was separating with `" "`, changed back to `writeLines`. Added 4 bytes (`cat` can be fixed by adding `,sep=""` to the function)
[Answer]
# C#, 592 572 Bytes
```
using System;class p{static void Main(){string[] s={"","","Polar Bear","Lion","Hippopotamus","Flamingo","Zebra","Boa Contrictor","Elephant","Leopard","Peacock","Walrus","Zookeeper","growl","roar","snort","flut","bray","hiss","trumpet","snarl","yelp","bellow","whistl"};for(int i=2;i<13;i++){s[0]+=(s[i]+", "+s[i]+", what do you hear?\nI hear "+(i<12?"a"+(i==7?"n ":" ")+s[i+1].ToLower()+" "+s[i+12]+"ing in my ear.\n\n":"children...\n\n..."));if(i<12)s[1]+=s[i+11]+"ing like a"+(i==8?"n ":" ")+s[i].ToLower()+(i<11?",\n":"...\nthat's what I hear.\n");}Console.Write(s[0]+s[1]);}}
```
Had such a great time taking this challenge with my colleague! Thanks for the idea.
Formatted:
```
using System;
class p {
    static void Main() {
        string[] s = { "", "", "Polar Bear", "Lion", "Hippopotamus", "Flamingo", "Zebra", "Boa Contrictor", "Elephant", "Leopard", "Peacock", "Walrus", "Zookeeper", "growl", "roar", "snort", "flut", "bray", "hiss", "trumpet", "snarl", "yelp", "bellow", "whistl" };
        for (int i = 2; i < 13; i++) {
            s[0] += (s[i] + ", " + s[i] + ", what do you hear?\nI hear " + (i < 12 ? "a" + (i == 7 ? "n " : " ") + s[i + 1].ToLower() + " " + s[i + 12] + "ing in my ear.\n\n" : "children...\n\n..."));
            if (i < 12) s[1] += s[i + 11] + "ing like a" + (i == 8 ? "n " : " ") + s[i].ToLower() + (i < 11 ? ",\n" : "...\nthat's what I hear.\n");
        }
        Console.Write(s[0] + s[1]);
        Console.ReadKey();
    }
}
```
**EDIT:** Thank you for your numerous and awesome tips, they helped a lot and I'll try to get the other ones working as well.
[Answer]
## Batch, ~~650~~ 647 bytes
```
@echo off
set e=echo(
set s=shift
call:d a "polar bear" ...growl "Polar Bear" a lion roar Lion a hippopotamus snort Hippopotamus a flamingo flut Flamingo a zebra bray Zebra a "boa constrictor" hiss "Boa Constrictor" an elephant trumpet Elephant a leopard snarl Leopard a peacock yelp Peacock a walrus bellow
exit/b
:d
call:v %* Walrus a zookeeper whistl Zookeeper
%e%I hear children...
%e%
:l
%e%%3ing like %1 %~2,
%s%
%s%
%s%
%s%
if not "%5"=="" goto l
%e%%3ing like a %2...
%e%that's what I hear.
exit/b
:v
%e%%~4, %~4, what do you hear?
if "%5"=="" exit/b
%e%I hear %5 %~6 %7ing in my ear.
%e%
%s%
%s%
%s%
%s%
goto v
```
Because `%*` is the nearest thing Batch has to an array. If I can use `Polar bear` and `Boa constrictor` then I can save 10%... but I'm still more than 50% of the original text...
Edit: Saved 3 bytes by setting `e=echo(` with a `(` instead of a space, which allows me to use it to echo blank lines, although I then have to write out `@echo off` in full.
[Answer]
## Bash + zcat, 402 bytes
Just a joke:  
a 2 lines bash script that tails itself and pipe the second line to zcat.  
The second line is the gzipped text.
How to prepare it: all the text in a file `a`. Then
```
echo "tail -n+2 \$0|zcat;exit" > go.sh
gzip a ;
cat a.gz >> go.sh
chomod u+x go.sh
```
The file so created when executed returns the starting text, 402 Bytes.
[Answer]
# F#, ~~591~~ ~~589~~ ~~579~~ ~~576~~ ~~573~~ ~~567~~ 552 bytes
This is my first try at code golfing with a language i like. I bet there are some ways this could be made shorter. Runs in FSI, so no need for .NET boilerplate.
Edit: Shaved 10 bytes by removing `\r`. It still renders fine in VSCode so go figure. Cut another three bytes with function composition, and another three with a lambda, then six with a for loop instead of Seq.iter (getting rid of the lambda). Finally 15 bytes were cut by rearranging `a(s:string)`
```
let A="Polar Bear,Lion,Hippopotamus,Flamingo,Zebra,Boa Constrictor,Elephant,Leopard,Peacock,Walrus,Zookeeper".Split(',')
let S="growl,roar,snort,flut,bray,hiss,trumpet,snarl,yelp,bellow,whistl".Split(',')
let a(s:string)=(if s.[0]='E'then"an "else"a ")+s.ToLower()
let f i=sprintf"%s, %s, what do you hear?\nI hear "A.[i]A.[i]
for i in 0..9 do printfn"%s%s %sing in my ear.\n"(f i)(a A.[i+1])S.[i+1]
printf"%schildren...\n\n..."(f 10)
let t i=sprintf"%sing like %s"S.[i](a A.[i])
Seq.iter(t>>printfn"%s,")[0..8]
printfn"%s...\nthat's what I hear."(t 9)
```
[Answer]
## Emacs Lisp, 576 (621) bytes
```
(let*((a'("polar bear""lion""hippopotamus""flamingo""zebra""boa constrictor""elephant""leopard""peacock""walrus""zookeeper"))(l(length a))(m(- l 1))(s'("growl""roar""snort""flut""bray""hiss""trumpet""snarl""yelp""bellow""whistl")))(dotimes(i l)(message"%s, what do you hear?"(let((a(capitalize(nth i a))))(concat a", "a)))(if(not(eq i m))(message "I hear a %s %sing in my ear.\n"(nth(1+ i)a)(nth(1+ i)s))(message"I hear children...\n")(dotimes(j m)(message(concat(when(eq j 0)"...")"%sing like a %s"(if(eq(1+ j)m)"..."","))(nth j s)(nth j a)))(message"That's what I hear."))))
```
When fixing "an elephant", it takes slightly longer:
```
(let*((a'("polar bear""lion""hippopotamus""flamingo""zebra""boa constrictor""elephant""leopard""peacock""walrus""zookeeper"))(l(length a))(m(- l 1))(s'("growl""roar""snort""flut""bray""hiss""trumpet""snarl""yelp""bellow""whistl")))(dotimes(i l)(message"%s, what do you hear?"(let((a(capitalize(nth i a))))(concat a", "a)))(if(not(eq i m))(message "I hear a %s %sing in my ear.\n"(nth(1+ i)a)(nth(1+ i)s))(message"I hear children...\n")(dotimes(j m)(message(concat(when(eq j 0)"...")"%sing like a"(and(string-match-p"^[aeiou]"(nth j a))"n")" %s"(if(eq(1+ j)m)"..."","))(nth j s)(nth j a)))(message"That's what I hear."))))
```
Ungolfed:
```
(let* ((animals '("polar bear"
                  "lion"
                  "hippopotamus"
                  "flamingo"
                  "zebra"
                  "boa constrictor"
                  "elephant"
                  "leopard"
                  "peacock"
                  "walrus"
                  "zookeeper"))
       (l (length animals))
       (m(- l 1))
       (sounds '("growl"
                 "roar"
                 "snort"
                 "flut"
                 "bray"
                 "hiss"
                 "trumpet"
                 "snarl"
                 "yelp"
                 "bellow"
                 "whistl")))
  (dotimes (i l)
    (message "%s, what do you hear?"
             (let ((animal (capitalize (nth i animals))))
               (concat animal ", " animal)))
    (if (not (eq i m))
        (message "I hear a %s %sing in my ear.\n"
                 (nth (1+ i) animals)
                 (nth (1+ i) sounds))
      (message "I hear children...\n")
      (dotimes (j m)
        (message
         (concat
          (when (eq j 0) "...")
          "%sing like a"
          (and (string-match-p"^[aeiou]" (nth j animals)) "n")
          " %s"
          (if (eq (1+ j) m) "..." ","))
         (nth j sounds )
         (nth j animals)))
      (message"That's what I hear."))))
```
[Answer]
# C, 596 bytes
Call `f()` without any arguments.
This is not the best golf in the world, I probably can shrink it more.
```
f(n){char*t,a[99][99]={"Polar Bear","Lion","Hippopotamus","Flamingo","Zebra","Boa Constrictor","Elephant","Leopard","Peacock","Walrus","Zookeeper","growl","roar","snort","flut","bray","hiss","trumpet","snarl","yelp","bellow","whistl"};for(n=0;n<11;){strcpy(t=a[n+30],n^6?" ":"n ");strcat(t,a[n++]);for(;*t=tolower(*t);++t);}for(n=0;printf("%s, %s, what do you hear?\n",a[n],a[n]),n<10;++n)printf("I hear a%s %sing in my ear.\n\n",a[n+31],a[12+n]);puts("I hear children...\n");for(n=11;n<21;++n)printf("%s%sing like a%s%s\n",n^11?"":"...",a[n],a[n+19],n^20?",":"...");puts("that's what I hear.");}
```
[Try it on ideone.](http://ideone.com/cyOIob)
[Answer]
# Python 3, ~~442~~ 441 bytes
```
h=t=''
for n,s in zip('polar bear,lion,hippopotamus,flamingo,zebra,boa constrictor,elephant,leopard,peacock,walrus,zookeeper'.split(','),'...growl roar snort flut bray hiss trumpet snarl yelp bellow whistl'.split()):u='n'[:'el'in n],n,s,n.title();h+="I hear a{0} {1} {2}ing in my ear.\n\n{3}, {3} what do you hear?\n".format(*u);t+="{2}ing like a{0} {1},\n".format(*u)
print((h+'I hear children...\n\n'+t)[44:-30]+"...\nthat's what I hear.")
```
# ungolfed:
```
animals = 'polar bear,lion,hippopotamus,flamingo,zebra,boa constrictor,elephant,leopard,peacock,walrus,zookeeper'.split(',')
sounds = '...growl roar snort flut bray hiss trumpet snarl yelp bellow whistl'.split()
h=t=''
for n,s in zip(animals,sounds):
    u='n'[:'el'in n], n, s, n.title()
    h+="I hear a{0} {1} {2}ing in my ear.\n\n{3}, {3} what do you hear?\n".format(*u)
    t+="{2}ing like a{0} {1},\n".format(*u)
print((h+'I hear children...\n\n'+t)[44:-30]+"...\nthat's what I hear.")
```
Basically, just a loop that builds up two strings representing the two parts of the story. The `'n'[:'el'in n]` handles the "an" for elephant. The `[44:-30]` chops off the leading "I hear a polar bear growling in my ear" and the trailing "whistling like a zookeeper".
[Answer]
## QB64 (QuickBASIC), 581 bytes
The code expands a bit when you throw it in the interpreter, but this source file is valid to load as-is. If you want to see the whole output before it scrolls past, then you'll need to add a `width 80,46` statement to the beginning.
```
READ a$,v$
FOR x=0 TO 10
?a$+", "+a$+", what do you hear?"
IF x>9THEN
?"I hear children...":?:?"...";
RESTORE
FOR y=0 TO 9
READ a$,v$
?v$+"ing like ";
CALL j(a$)
IF y<9THEN?", "ELSE?"...":?"that's what I hear."
NEXT
END
ELSE
READ a$,v$
?"I hear ";
CALL j(a$)
?" "+v$+"ing in my ear."
?
END IF
NEXT
DATA"Polar Bear","growl","Lion","roar","Hippopotamus","snort","Flamingo","flut","Zebra","bray","Boa Constrictor","hiss","Elephant","trumpet","Leopard","snarl","Peacock","yelp","Walrus","bellow","Zookeper","whistl"
SUB j (A$)
?"a";
IF LEFT$(A$,1)="E"THEN?"n";
?" "+LCASE$(A$);
END SUB
```
[Answer]
# **LUA 535 bytes**
```
p=print a="growl.roar.snort.flut.bray.hiss.trumpet.snarl.yelp.bellow.whist"b="polar bear.lion.hippopotamus.flamingo.zebra.boa constrictor.elephant.leopard.peacock.walrus.zookeeper."z=a.gmatch(a,"%P+")x=b.gmatch(b,"%P+")w=''for j=1,11 do i=x()v=z()e=j==7 and'n 'or' 'p(j==1 and''or'I hear a'..e..i..' '..v..'ing in my ear.\n')w=w..(j>10 and''or v..'ing like a'..e..i..(j>9 and'...'or',')..'\n')y=i:gsub("^%l",a.upper):gsub("%s%l",a.upper)p(y..', '..y..' what do you hear?')end p('I hear children...\n')p('...'..w.."that's what I hear.")
```
## **ungolfed:**
```
sound_list = "growl.roar.snort.flut.bray.hiss.trumpet.snarl.yelp.bellow.whist"
animal_list = "polar bear.lion.hippopotamus.flamingo.zebra.boa constrictor.elephant.leopard.peacock.walrus.zookeeper."
sound_it = string.gmatch(sound_list, "%P+")
animal_it = string.gmatch(animal_list, "%P+")
part_2 = ''
for i = 1, 11  do
    animal = animal_it()
    sound = sound_it()
    aORan = i == 7 and 'n ' or ' '
    print(i == 1 and '' or 'I hear a'..aORan..animal..' '..sound..'ing in my ear.\n')
    part_2 = part_2..(i > 10 and '' or sound..'ling like a'..aORan..animal..(i > 9 and '...' or ',')..'\n')
    big_animal = animal:gsub("^%l", string.upper):gsub("%s%l", string.upper)
    print(big_animal..', '..big_animal..' what do you hear?')
end
print('I hear children...\n')
print('...'..part_2.."that's what I hear.")
```
[Try it online](http://goo.gl/Bcu0AZ)
[Answer]
# PHP, 366 bytes
Lazy answer, but why write a custom decompressor when gzip is available?
Hex dump of PHP code (can be saved with *xxd -r*)
```
0000000: 3c3f 3d67 7a69 6e66 6c61 7465 2827 7d53  <?=gzinflate('}S
0000010: c16a 8430 10bd e72b e6d6 cbe0 2f14 b6b4  .j.0...+..../...
0000020: b4d0 c3de 0abd 8d6e baca c64c 1823 62bf  .......n...L.#b.
0000030: be51 3354 1472 58f3 76de f864 e6bd 5cd9  .Q3T.rX.v..d..\.
0000040: 91c0 c592 20ec f1d4 5284 1bc3 cc23 b4a9  .... ...R....#..
0000050: f26c 3ed6 1308 5cc7 1e84 493a 7f87 ce43  .l>...\...I:...C
0000060: 3f43 222a 633e 1381 b03d 0bef b75d 081c  ?C"*c>...=...]..
0000070: 3852 3f0e 3078 9678 147a df75 20ec ff15  8R?.0x.x.z.u ...
0000080: 857f 1cf5 498a 1318 4f9a 6f99 4450 54d4  ....I...O.o.DPT.
0000090: fab5 b510 a4df 7c14 fa5e 1884 7c14 246a  ......|..^..|.$j
00000a0: 2668 d80f 51ba 26b2 a4b9 87e1 2876 6182  &h..Q.&.....(va.
00000b0: 97ff 1e84 63a1 f001 0fd6 d9d0 928f 1065  ....c..........e
00000c0: ec83 3dcd fc9a 7904 4565 632d 0792 5bf2  ..=...y.Eec-..[.
00000d0: 84c4 9dcc dd48 0405 25a5 60a9 e1e6 01b3  .....H..%.`.....
00000e0: 75e1 2874 dd38 0405 25a1 899c a494 d4d6  u.(t.8..%.......
00000f0: 399e 8e4a 5f2b 89a0 67c9 4ee6 87b5 c10a  9..J_+..g.N.....
0000100: 4cc9 86e8 4ea6 2a8f a0b0 b4fb a6ed dc4d  L...N.*........M
0000110: acaf aaf4 6e7a dc85 a755 d375 0fbb ccbf  ....nz...U.u....
0000120: dea4 3ab5 a211 2651 2adf 1e34 1a7b adb6  ..:...&Q*..4.{..
0000130: fb8c 1bcd 6f26 35d7 6896 3c2a a121 45a3  ....o&5.h.<*.!E.
0000140: c1ca d543 eed0 683a b465 971c 34d9 6ca5  ...C..h:.e..4.l.
0000150: 3404 68d4 3b1d 29bb 65b2 17ca a847 cb2a  4.h.;.).e....G.*
0000160: 624b f169 d8d6 b66d aa32 7f27 293b       bK.i...m.2.');
```
I used a few iterations of [zopfli](https://github.com/google/zopfli) to convert the source text to 349 bytes of compressed data, avoiding the ' character which would otherwise have to be escaped with backslashes.
[Answer]
# [Japt](https://github.com/ETHproductions/japt), ~~308~~ ~~303~~ ~~299~~ ~~295~~ ~~288~~ ~~280~~ ~~294~~ ~~289~~ 286 bytes
Contains a bunch of unprintables; follow the link below to view them.
```
`Pol BÁLiyHippopotam«yFlaÚÁoyZeßBoa CÆqÎtyE¤pÊCyLeopÂýPea¬ckyWalr«yZookeep`qy
`gwÓ2ÂüÍdfl©dßdÊdtruÛFdsnÓ)lpdÞ)owdØtl`qd
[¡[X',SX`, Ø º y Ê#?
I Ê# `Y<A?[Y¶5?``:'aSUg°Y v SVgY `g  my e.`R]¬:[`å,Á`Q='.³R²QU¯J £[Vv `g ¦ke `Y¶6?``:'aSXv]¬Ãq`,
` QR`È  's Ø I Ê#.`]¬]¬Ã·]¬
```
[Test it](https://ethproductions.github.io/japt/?v=1.4.5&code=YFBvbIcgQsEdTGmNeUhpcHBvcG90YW2reUZsYdrBb3laZd+fQm9hIEPGcc50jnlFpHDKQ3lMZW9wwv1QZWGsY2t5V2Fscqt5Wm9va2VlcIBgcXkKYGeed9MywvzNFmRmbKlk359kyo1kdHJ120Zkc26H0ylscGTeKW93ZNiRdGxgcWQKW6FbWCcsU1hgLCDYiSC6IHmMIMojPwpJIMojIGBZPEE/W1m2NT9ghGA6J2FTVWewWSB2IFNWZ1kgYIhnIIggbXkgZYcuYFJdrDpbYOWRLMFgUT0nLrNSslFVr0ogo1tWdiBgiGcgpmtlIGBZtjY/YIRgOidhU1h2XazDcWAsCmAgUVJgyAkncyDYiSBJIMojLmBdrF2sw7ddrA==&input=)
+14 bytes 'cause I'd ballsed up the walrus' line; will need to take another pass over it next week to see if I can get any of those bytes back.
[Answer]
# Pyth, 342 bytes
```
L:b"a e""an e"y>sm.F"
I hear a {1} {0} in my ear.
{2}, {2}, what do you hear?"+dr3edJC,+R"ing"c"growl
roar
snort
flut
bray
hiss
trumpet
snarl
yelp
bellow
whistl"bc"polar bear
lion
hippopotamus
flamingo
zebra
boa constrictor
elephant
leopard
peacock
walrus
zookeeper"b42"I hear children...
"jPPysm+j" like a "d",
"PJc2*6\."that's what I hear.
```
Try it online [here](https://pyth.herokuapp.com/?code=L%3Ab%22a+e%22%22an+e%22y%3Esm.F%22%0AI+hear+a+%7B1%7D+%7B0%7D+in+my+ear.%0A%0A%7B2%7D%2C+%7B2%7D%2C+what+do+you+hear%3F%22%2Bdr3edJC%2C%2BR%22ing%22c%22growl%0Aroar%0Asnort%0Aflut%0Abray%0Ahiss%0Atrumpet%0Asnarl%0Ayelp%0Abellow%0Awhistl%22bc%22polar+bear%0Alion%0Ahippopotamus%0Aflamingo%0Azebra%0Aboa+constrictor%0Aelephant%0Aleopard%0Apeacock%0Awalrus%0Azookeeper%22b42%22I+hear+children...%0A%22jPPysm%2Bj%22+like+a+%22d%22%2C%0A%22PJc2%2a6%5C.%22that%27s+what+I+hear.&debug=0).
Explanation to follow.
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), ~~400~~ 399 bytes
```
((my \a=<<"Polar Bear"Lion Hippopotamus Flamingo Zebra"Boa Constrictor"Elephant Leopard Peacock Walrus Zookeeper>>)>>.&{"$_, $_, what do you hear?
I hear a {a[++$!].lc} {($/=<growl roar snort flut bray hiss trumpet snarl yelp bellow whistl>)[$!]}ing in my ear.
"},"...{a[^10]>>.&{$/[$++]~"ing like a",.lc}.join(",
")}...
that's what I hear.")>>.trans(["a e",/a\s\s.*r/]=>["an e","children.."])>>.say
```
[Try it online!](https://tio.run/##JY9Bb8IwDIXv/AovqrayVmG77ASdxLRpkzhwmwR0kykZzUjjyAlCFer@epfCwbJk@/l9zyk2T32fpk0LG5xNp2JJBhnmClksNFl4186Ro4DN0cObwUbbPcFKbRnFnBBeyPrAugrE4tUoV6MNsFDkkHewVFhRdYBPNBzlK6KDUk5xUYyLQt6eRfKdw1CnGgPsCFo6Qh29n0cflw4IZ1xnWXJTSlN1cE6TyWy6ZzoZYIp7b4kD/JhjgEjUQq29h8DHxqkQl8gGWmUcbJUxdIo@2gdTjNfxYReTgLYQo0cnORJdLqSU0e/r8aG88CWTdZJl5Z8YTo0@KECRDyDyl7RNRT4S4y5qRiHy3/lrjCu5FEPEwGh9uhYISuQT3PiNl/c8KWdFnNlhKKpamx0rK6UoB4nHtu//AQ "Perl 6 – Try It Online")
Sub-400 bytes!
[Answer]
# Powershell ~~921~~ ~~889~~ ~~886~~ 898 Bytes
it's not perfect, but it saves 300 Bytes :)
**EDIT:**
Thanks Jonathan Frech, i saved 32 Bytes. And thank you Veskah for correcting the Output.
```
filter Z($1,$2){while($1){$x,$1=$1
$y,$2=$2
[tuple]::Create($x,$y)}}
$0="ing"
$$="hear"
$1="I $$ a "
$3='in my ear.'
$a='Polar Bear'
$b='Lion'
$c='Hippopotamus'
$d='Flamingo'
$e='Zebra'
$f='Boa Constrictor'
$g='Elephant'
$h='Leopard'
$i='Peacock'
$j='Walrus'
$k='Zookeeper'
$v="children"
$2="roar$0"
$4="snort$0"
$5="flut$0"
$6="bray$0"
$7="hiss$0"
$8="trumpet$0"
$9="snarl$0"
$x="yelp$0"
$y="bellow$0"
$^="whistl$0"
$l="$1$b $2$3"
$m="$1$c $4$3"
$n="$1$d $5$3"
$o="$1$e $6$3"
$p="$1$f $7$3"
$q="I $$ an $g $8$3"
$r="$1$h $9$3"
$s="$1$i $x$3"
$t="$1$j $y$3"
$u="$1$k $^$3"
$z=' like a '
$w="I $$ $v..."
z $a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k $l,$m,$n,$o,$p,$q,$r,$s,$t,$u,$w|%{"$($_.item1),"*2+"what do you $$?";$_.item2;""}
"...growl$0$z$a,"
z $b,$c,$d,$e,$f $2,$4,$5,$6,$7|%{$_.item2+$z+$_.item1+","}
"$8 like an $g,"
z $h,$i $9,$x,$y|%{$_.item2+$z+$_.item1+","}
$y+$z+"Walrus..."
"that's what I $$."
```
[Answer]
# clojure, 526 bytes
```
(use 'clojure.string)(let[l lower-case
a(partition 2(split"Polar Bear,...growl,Lion,roar,Hippopotamus,snort,Flamingo,flut,Zebra,bray,Boa Constrictor,hiss,Elephant,trumpet,Leopard,snarl,Peacock,yelp,Walrus,bellow,Zookeeper,whistl,children,x"#","))b(map(fn[[w x][y e]][(str
w", "w", what do you hear?
I hear a "(l y)" "e"ing in my ear.
")(str x"ing like a "(l w))])a(rest a))r
replace](print(r(str(r(join""(map first b))#".*x.*""I hear children...")(join",
"(butlast(map last b)))"...
that's what I hear.")#"(?i)a(?= e)""an")))
```
Here's my initial attempt. Gotta love the formatting and how unreadable it is. Hope the warnings from `use 'clojure.string` are acceptable.
[Try it online.](http://ideone.com/UUrWEN)
Formatted code:
```
(use 'clojure.string)
(let [animal-sound (partition 2 (split "Polar Bear,...growl,Lion,roar,Hippopotamus,snort,Flamingo,flut,Zebra,bray,Boa Constrictor,hiss,Elephant,trumpet,Leopard,snarl,Peacock,yelp,Walrus,bellow,Zookeeper,whistl,children,x" #","))
      sentences (map (fn [[animal-1 sound-1] [animal-2 sound-2]]
                       [(str animal-1 ", " animal-1 ", what do you hear?\nI hear a "
                             (lower-case animal-2) " " sound-2 "ing in my ear.\n\n") (str sound-1 "ing like a " (lower-case animal-1))])
                     animal-sound (rest animal-sound))]
  (print (replace (str
                    (replace (join "" (map first sentences)) #".*x.*" "I hear children...")
                    (join ",\n" (butlast (map last sentences)))
                    "...\nthat's what I hear.") #"(?i)a(?= e)" "an")))
```
[Answer]
# Java, ~~571 555~~ 538 or 516 Bytes
```
String p(){String r="",z="...",b,x;String[]a="Polar Bear!Lion!Hippopotamus!Flamingo!Zebra!Boa Constrictor!Elephant!Leopard!Peacock!Walrus!Zookeeper!growling!roaring!snorting!fluting!braying!hissing!trumpeting!snarling!yelping!bellowing!whistling".split("!");for(int i=1;i<11;i++){b=i==6?"n ":" ";x=a[i-1];z+=a[i+10]+" like a"+b+x+(i==10?"...":"\n");r+=x+" , "+x+", what do you hear?\n I hear a"+b+a[i].toLowerCase()+" "+a[i+11]+" in my ear.\n\n";}r+=a[10]+" what do you hear?\n\tI hear children...\n"+z+"\nthat's what I hear.";return r;}
```
But only 516 bytes is required to get result in JShell
```
String r="",z="...",b,x;String[]a="Polar Bear!Lion!Hippopotamus!Flamingo!Zebra!Boa Constrictor!Elephant!Leopard!Peacock!Walrus!Zookeeper!growling!roaring!snorting!fluting!braying!hissing!trumpeting!snarling!yelping!bellowing!whistling".split("!");for(int i=1;i<11;i++){b=i==6?"n ":" ";x=a[i-1];z+=a[i+10]+" like a"+b+x+(i==10?"...":"\n");r+=x+" , "+x+", what do you hear?\n I hear a"+b+a[i].toLowerCase()+" "+a[i+11]+" in my ear.\n\n";}r+=a[10]+" what do you hear?\n\tI hear children...\n"+z+"\nthat's what I hear."
```
[Answer]
## Swift2, **519 bytes**
```
var a=["Polar Bear","Lion","Hippopotamus","Flamingo","Zebra","Boa Constrictor","Elephant","Leopard","Peacock","Warlus","Zookeeper"],b=["...growl","roar","snort","flut","bray","hiss","trumpet","snarl","yelp","bellow","whistl"].map{"\($0)ing"},c=a.enumerate().map{"\($0.0==6 ?"an":"a") \($0.1)".lowercaseString},i=0,j=0
while i<11{print("\(a[i]), \(a[i++]), what do you hear?\nI hear \(i>10 ?"children...":"\(c[i]) \(b[i]) in my ear")\n")}
while j<10{print("\(b[j]) like \(c[j++])\(j>9 ?"...\nthat's what I hear.":",")")}
```
[Answer]
# Haskell 537 499 497 Bytes
```
import Data.Char
a&b=a++b
b=putStr
c=concat
d=init
e('E':s)="an e"&s
e s="a "&map toLower s
f="I hear "
l=zip(lines"Polar Bear\nLion\nHippopotamus\nFlamingo\nZebra\nBoa Constrictor\nElephant\nLeopard\nPeacock\nWalrus\nZookeeper")$words"growl roar snort flut bray hiss trumpet snarl yelp bellow whistl"
main=(b.drop 41.c)[f&e n&" "&v&"ing in my ear.\n\n"&n&", "&n&", what do you hear?\n"|(n,v)<-l]>>b(f&"children...\n\n..."&(d.d.c)[v&"ing like "&e n&",\n"|(n,v)<-d l]&"...\nthat's what I hear.\n")
```
Using the convention that a solution does not have be executable, only produce the output via some function, this can be shortened to 479 Bytes. The output is in `g`:
```
import Data.Char
a&b=a++b
c=concat
d=init
e('E':s)="an e"&s
e s="a "&map toLower s
f="I hear "
l=zip(lines"Polar Bear\nLion\nHippopotamus\nFlamingo\nZebra\nBoa Constrictor\nElephant\nLeopard\nPeacock\nWalrus\nZookeeper")$words"growl roar snort flut bray hiss trumpet snarl yelp bellow whistl"
g=(drop 41.c)[f&e n&" "&v&"ing in my ear.\n\n"&n&", "&n&", what do you hear?\n"|(n,v)<-l]&f&"children...\n\n..."&(d.d.c)[v&"ing like "&e n&",\n"|(n,v)<-d l]&"...\nthat's what I hear.\n"
```
[Answer]
# [C (clang)](http://clang.llvm.org/), 552 bytes
```
(*P)()=printf;l(char*s){for(;*s;s++)putchar(*s>64?*s|32:*s);}char*a[]={"Zookeeper","Walrus","Peacock","Leopard","Elephant","Boa Constrictor","Zebra","Flamingo","Hippopotamus","Lion","Polar Bear"},*s[]={"whistl","bellow","yelp","snarl","trumpet","hiss","bray","flut","snort","roar","growl"};f(i){for(i=11;i--;)P("%s, %s, what do you hear?\nI hear%s ",a[i],a[i],i?i^5?" a":" an":""),i?l(a[i-1]):0,P(i?" %sing in my ear.\n\n":"children...\n\n...",s[i-1]);for(i=11;--i;)P("%sing like a%s ",s[i],i^4?"":"n"),l(a[i]),P(i-1?",\n":"...\nthat's what I hear.");}
```
[Try it online!](https://tio.run/##PVLBitswED03XyEEoZLXDk1320NMatjS0sIecivsJguzjhyLyBohyYSQ5tvTkVz24JnH6Om9N7bbqjVgD7ebKDZSyLXz2sauNqLtwRdBXjr0oi5CHe7upBtjGosifPv60BTh7/3nFXHqaybDy2594c@IR6Wc8rzkf8D4MRDYKGixPRJ6UujA7wn9MMr1YCPBRwT2HW2IXrcR081n9eaB@k8Dg7YHJPhLO4cOIwxZ8kmjTcpowLNHBZ5fyyLkCKdeh2jo8E0ZgycCZ2UctWDBp3n04@BUciZmEiOzM7XOjDHT0KfuEVKWg8eT4de6E3p6HXq9XNa6qmq5EXweSpaeUw@R7ZGdcWQ9xWm29ncG88B4CS96NxXd6NcvDWfAV1QsVS5paASdVsudXH0qN0ITYR5ocaYtG86MZBZbu03sttdm75VdLPKEGi/DdLV@D1dV@n@4pGH0UTHIOUKO8PrQcJKy5Jx9dzJ5VsuGl9kja0da6GOY9po2WXD61Df6P9gA2go5u8w@dELWs@vtHw "C (clang) – Try It Online")
[Answer]
# [Perl 5](https://www.perl.org/), 413 bytes
```
@t=('Polar Bear',growl,Lion,roar,Hippopotamus,snort,Flamingo,flut,Zebra,bray,'Boa Constrictor',hiss,Elephant,trumpet,Leopard,snarl,Peacock,yelp,Walrus,bellow,Zookeeper,whistl);say$_=$t[$i],", $_, what do you hear?
I hear ",/Zo/?"children...
":"a".n x(/C/).lc" $t[$i+=2] $t[$i+1]ing in my ear.
"while!/Zo/;pop@t;pop@t;print'...';say+(shift@t)."ing like a ".lc.(@t?",":'...')while$_=shift@t;say"that's what I hear."
```
[Try it online!](https://tio.run/##NZFNawIxEIbv/oo0CLuL06wWvCjiorS0YMFbwSIS1@gGYyYkI3b/fLfZ1R7ycZh53nkSp7wZN01BszRZo5GeLZT0CZw83gysNFrwKD28a@fQIcnLNUCw6AnejLxoe0I4mivBRu29hLhqSBYo2RJtIK9LwkirdAjwapSrpCUgf704RbBS6KQ/RJz0BtZKllieoVbGwZc0PgbtlTF4gw3iWSmnPNwiiUw2DbLu72Z9@u7rLXBg/R2wWyWJHZDVeGVVlJj3PrqTccg3mM95WWlz8MoKIXp8wiUXlv2k@TLPhCk562iD2cv2cRttox3Tll1qFjGxJ6Yb9dTCpvExCvrfvbaURGrSzjVIQ6WPVFAmeAsw@qyYZDxmiLSgOQc@6YqzDhc1HvVtM6cokYS7y318wZvmFx3FrwjN8@dYDEfDPw "Perl 5 – Try It Online")
]