[Question]
  [
Here is the (quite scary) Five little ducks song(it is not long):
```
Five little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only four little ducks came back.
Four little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only three little ducks came back.
Three little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only two little ducks came back.
Two little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only one little duck came back.
One little duck went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but none of the little ducks came back.
Mother duck herself went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
and all of the little ducks came back.
```
Your task is not to output this song. You should take a verse and output the next verse, cyclically (the next verse of the last verse is the first verse).
## Rules
* No standard loopholes, please.
* Input/output will be taken via our standard input/output methods.
* The *exact* verse must be outputted, and there should be no differences when compared to the song lyrics. The input will not be different when it is compared to the song lyrics too.
## Examples
```
Mother duck herself went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
and all of the little ducks came back.
```
Expected:
```
Five little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only four little ducks came back.
```
---
```
Three little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only two little ducks came back.
```
Expected:
```
Two little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only one little duck came back.
```
## The Catalogue
The Stack Snippet at the bottom of this post generates the catalogue from the answers a) as a list of shortest solution per language and b) as an overall leaderboard.
To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:
```
## Language Name, N bytes
```
where `N` is the size of your submission. If you improve your score, you *can* keep old scores in the headline, by striking them through. For instance:
```
## Ruby, <s>104</s> <s>101</s> 96 bytes
```
If there you want to include multiple numbers in your header (e.g. because your score is the sum of two files or you want to list interpreter flag penalties separately), make sure that the actual score is the *last* number in the header:
```
## Perl, 43 + 2 (-p flag) = 45 bytes
```
You can also make the language name a link which will then show up in the snippet:
```
## [><>](https://esolangs.org/wiki/Fish), 121 bytes
```
```
/* Configuration */
var QUESTION_ID = 193467; // Obtain this from the url
// It will be like https://XYZ.stackexchange.com/questions/QUESTION_ID/... on any question page
var ANSWER_FILTER = "!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";
var COMMENT_FILTER = "!)Q2B_A2kjfAiU78X(md6BoYk";
var OVERRIDE_USER = 8478; // This should be the user ID of the challenge author.
/* App */
var answers = [], answers_hash, answer_ids, answer_page = 1, more_answers = true, comment_page;
function answersUrl(index) {
  return "https://api.stackexchange.com/2.2/questions/" +  QUESTION_ID + "/answers?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + ANSWER_FILTER;
}
function commentUrl(index, answers) {
  return "https://api.stackexchange.com/2.2/answers/" + answers.join(';') + "/comments?page=" + index + "&pagesize=100&order=desc&sort=creation&site=codegolf&filter=" + COMMENT_FILTER;
}
function getAnswers() {
  jQuery.ajax({
    url: answersUrl(answer_page++),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      answers.push.apply(answers, data.items);
      answers_hash = [];
      answer_ids = [];
      data.items.forEach(function(a) {
        a.comments = [];
        var id = +a.share_link.match(/\d+/);
        answer_ids.push(id);
        answers_hash[id] = a;
      });
      if (!data.has_more) more_answers = false;
      comment_page = 1;
      getComments();
    }
  });
}
function getComments() {
  jQuery.ajax({
    url: commentUrl(comment_page++, answer_ids),
    method: "get",
    dataType: "jsonp",
    crossDomain: true,
    success: function (data) {
      data.items.forEach(function(c) {
        if (c.owner.user_id === OVERRIDE_USER)
          answers_hash[c.post_id].comments.push(c);
      });
      if (data.has_more) getComments();
      else if (more_answers) getAnswers();
      else process();
    }
  });  
}
getAnswers();
var SCORE_REG = /<h\d>\s*([^\n,<]*(?:<(?:[^\n>]*>[^\n<]*<\/[^\n>]*>)[^\n,<]*)*),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/;
var OVERRIDE_REG = /^Override\s*header:\s*/i;
function getAuthorName(a) {
  return a.owner.display_name;
}
function process() {
  var valid = [];
  
  answers.forEach(function(a) {
    var body = a.body;
    a.comments.forEach(function(c) {
      if(OVERRIDE_REG.test(c.body))
        body = '<h1>' + c.body.replace(OVERRIDE_REG, '') + '</h1>';
    });
    
    var match = body.match(SCORE_REG);
    if (match)
      valid.push({
        user: getAuthorName(a),
        size: +match[2],
        language: match[1],
        link: a.share_link,
      });
    else console.log(body);
  });
  
  valid.sort(function (a, b) {
    var aB = a.size,
        bB = b.size;
    return aB - bB
  });
  var languages = {};
  var place = 1;
  var lastSize = null;
  var lastPlace = 1;
  valid.forEach(function (a) {
    if (a.size != lastSize)
      lastPlace = place;
    lastSize = a.size;
    ++place;
    
    var answer = jQuery("#answer-template").html();
    answer = answer.replace("{{PLACE}}", lastPlace + ".")
                   .replace("{{NAME}}", a.user)
                   .replace("{{LANGUAGE}}", a.language)
                   .replace("{{SIZE}}", a.size)
                   .replace("{{LINK}}", a.link);
    answer = jQuery(answer);
    jQuery("#answers").append(answer);
    var lang = a.language;
    lang = jQuery('<a>'+lang+'</a>').text();
    
    languages[lang] = languages[lang] || {lang: a.language, lang_raw: lang, user: a.user, size: a.size, link: a.link};
  });
  var langs = [];
  for (var lang in languages)
    if (languages.hasOwnProperty(lang))
      langs.push(languages[lang]);
  langs.sort(function (a, b) {
    if (a.lang_raw.toLowerCase() > b.lang_raw.toLowerCase()) return 1;
    if (a.lang_raw.toLowerCase() < b.lang_raw.toLowerCase()) return -1;
    return 0;
  });
  for (var i = 0; i < langs.length; ++i)
  {
    var language = jQuery("#language-template").html();
    var lang = langs[i];
    language = language.replace("{{LANGUAGE}}", lang.lang)
                       .replace("{{NAME}}", lang.user)
                       .replace("{{SIZE}}", lang.size)
                       .replace("{{LINK}}", lang.link);
    language = jQuery(language);
    jQuery("#languages").append(language);
  }
}
```
```
body {
  text-align: left !important;
  display: block !important;
}
#answer-list {
  padding: 10px;
  width: 290px;
  float: left;
}
#language-list {
  padding: 10px;
  width: 500px;
  float: left;
}
table thead {
  font-weight: bold;
}
table td {
  padding: 5px;
}
```
```
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/all.css?v=ffb5d0584c5f">
<div id="language-list">
  <h2>Shortest Solution by Language</h2>
  <table class="language-list">
    <thead>
      <tr><td>Language</td><td>User</td><td>Score</td></tr>
    </thead>
    <tbody id="languages">
    </tbody>
  </table>
</div>
<div id="answer-list">
  <h2>Leaderboard</h2>
  <table class="answer-list">
    <thead>
      <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr>
    </thead>
    <tbody id="answers">
    </tbody>
  </table>
</div>
<table style="display: none">
  <tbody id="answer-template">
    <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
<table style="display: none">
  <tbody id="language-template">
    <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr>
  </tbody>
</table>
```
  
[Answer]
# JavaScript (ES9), 227 bytes
This is similar to the Node version below but uses a formula based on `parseInt()` instead of `Buffer()` to identify the input verse.
This is [ES2018](https://www.ecma-international.org/ecma-262/9.0/index.html) (aka ES9) because we're using a regular expression with the `/s` flag ([dotAll](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/dotAll)).
```
s=>'Mother duck herself1and all23,,Three4two3,Five4four3,Four4three3,One01but none23,Two4one0'.split`,`[parseInt(s,30)&7].replace(/\d/g,n=>[x=' little duck',y=/ w.*\n/s.exec(s),' of the',x+='s',x+y+'but only '][n])+s.slice(-11)
```
[Try it online!](https://tio.run/##vZTfb9owEMff81ecKnWOi2tIQZu0yexlVJqmCpWivgASbuKUbJ4dxQkhfz09B1S1pT@eyot99vl799Eld3/lWrq4yPLy3NhEbVOxdWJIrmy5UgUkVfwP0HBKp5E0CUitL/qMTVeFUoOytn12ma3VILVVgSaug9K7@mxsVC@6q0ow1iiUTGs7QKtHuMt1Vi7ZcpZLjPvblKFj/R798m3BC5VrGauwO0@698yI4WwjCODzUquWhbBGdKHmZ3PTdVxtVBw6ygjYFJCXsE1HEOe3pkN8cmt0A2QxMwvacdzpDIOfRxHd3o4mNyMQsPT4TzM4qJVBYSvGK9mwwK6xFBgfVpnWDnwdqhxkLRse7Av1yxfKySxhcHJdSTwcrCcseETy9XqeNZb/FdzhMx4ElwfeYzC1H@5tqOmh@yhUtX2H6aXzGEQ@9JOkz4DGL3yfzON7a//vv12kV1r5M7n2U@IDrGWwmwMhmZu5IfRHELQtyVNbjGS8CnEoQEZBDCG2xlmtuLb3YYrtDh1AUUhw352FgFY7CzO8iyicwtcF/AQy/kPgO5DRZDKekFZHfS66fQA "JavaScript (Node.js) – Try It Online")
### How?
In this version, we parse the entire input verse as base 30 (`0` to `t`) and perform a bitwise AND with 7. The parsing stops on the first invalid character, leading to:
```
 verse | valid part | base 30 -> decimal | AND 7
-------+------------+--------------------+-------
   0   |  'fi'      |            468     |   4
   1   |  'fo'      |            474     |   2
   2   |  'three'   |       23973734     |   6
   3   |  't'       |             29     |   5
   4   |  'one'     |          22304     |   0
   5   |  'mother'  |      554838747     |   3
```
---
# [JavaScript (Node.js)](https://nodejs.org), ~~233 231~~ 227 bytes
*Saved 2 bytes thanks to @Shaggy*
```
s=>'Three4two3,Four4three3,Mother duck herself1and all23,One01but none23,,,Two4one0,,Five4four3'.split`,`[Buffer(s)[2]%9].replace(/\d/g,n=>[x=' little duck',y=/ w.*\n/s.exec(s),' of the',x+='s',x+y+'but only '][n])+s.slice(-11)
```
[Try it online!](https://tio.run/##vZRRb9MwEMff8ylOkyYn1HOXtUIC5CIh2heEKkrFSxqpXnJZA8au4qRpPn13ziq0rQye1pfY5/P/7udzzj/VTrmsKrf1lbE5Hgp5cHLClpsKcVy3dsRntqnGtbdH/KutN1hB3mS/gCYOdRErk4PS@mbE5wav49umBmMNks35srVjml9zPit3OC4o1IgJt9Vlvebr5FNTFFiFLkpu0st3qahwq1WG4XCVD@@4kZNkLxnQ5lpjn5TxTg6hFW9WZugE7jEjMWdgCyAwxvcDyZwfugHzINboDliamDQaOOF0ScGv4jg6/Jguvk9BwtpzPc7goEVDwl5MS6rjgd3RmSk@bEqtHfgDN1tQrepEcKzIZ18Rp8qcw8W3RpFx8r3gwR8kX4inWTP1G@GWtokgmJ14z8HUX/HLUMtT91moWvsPpufOcxD50I@SPgGaP/O9Mo/vs@O//3KR/tKzr8l1fA7@g7UOHl6BkK3MyrDoQxD0LSkKW01VtglDx6GMQE4gs8ZZjULbu7CgdocBkChkND7YUkKvTcKS1uIILuFtCh@Bzb8weA9suljMF6zXRT5XdLgH "JavaScript (Node.js) – Try It Online")
### How?
The third character of each input verse can be used as a unique identifier. By taking its ASCII code modulo 9, we get:
```
 verse | 3rd char. | ASCII code | MOD 9
-------+-----------+------------+-------
   0   |    'v'    |     118    |   1
   1   |    'u'    |     117    |   0
   2   |    'r'    |     114    |   6
   3   |    'o'    |     111    |   3
   4   |    'e'    |     101    |   2
   5   |    't'    |     116    |   8
```
The output verses are encoded with the following templates:
```
 verse | template
-------+---------------------------------
   0   | 'Five4four3'
   1   | 'Four4three3'
   2   | 'Three4two3'
   3   | 'Two4one0'
   4   | 'One01but none23'
   5   | 'Mother duck herself1and all23'
```
Where each digit is replaced with a string according to the following table:
```
 digit | replaced with
-------+---------------------------------------------------
   0   | ' little duck'
   1   | / w.*\n/s.exec(s)
   2   | ' of the'
   3   | ' little ducks'
   4   | ' little ducks' + / w.*\n/s.exec(s) + 'but only '
```
Where the regular expression `/ w.*\n/s` extracts this common part from the input:
```
  went out one day,[LF]
 over the hills and up away.[LF]
 Mother Duck said, "Quack Quack Quack Quack",[LF]
```
We finally add the last 11 characters of the input, which is `" came back."`.
[Answer]
# [Python 3](https://docs.python.org/3/), ~~267 263~~ 254 bytes
*4 bytes saved thanks to @ovs*
```
def f(s):
 for a in zip(T[2:]+T,T):s=s.replace(*a)
 return s
T="8:9:and allHO1BnoneHT2No1T3Nt2F4Nt3FiveINf4MotherD herself"
for r in "H of theI,4ourI,3hreeI,2woI,1neL:,ILs:,L littleD,D duck,NBonly ,Bbut ".split(','):T=T.replace(r[0],r[1:])
T=T.split(':')
```
[Try it online!](https://tio.run/##vZTBitswEIbveopBl9itGhonhVbgw4YQYki9W1Y3rw9KLBNRrWQkOSF9@VRKTOlu2Pa00UEgzeifbwT/dEe/M3p6OjWihTZxKUXQGgscpIZfsktYldH6IyMspS53Yys6xbci@cBTBFb43mpwiOX4K/1GuW6AK7W6n8y10WLFstJM2LT02XJW@ulS7kVRtrPvxu@EXUDYnFAtRrGgjQXxCkwLIVqQmeltQaY7K8IhO5iCTLRYU1KsHSVrUNJ7JRZkAU2//UnKudHqCGS@6T3gsetCPBmRUUpZzv5A2@pzTWw1oXWK4v2QRkfpaR9ZXI4xjpSD/FnbwUFoDyYIh56g4UeCTEiPmLCTSjmIffcd8AM/jtGlO1iEp@C4bAjgHz0Ph6sdE7Q5qwbyNrT7suqWPwvYhLQxQsur6C2YfPz8t6HYdfgmVAfzD6bXwVsQRem/ir4Aun8Ve2eeaLvBQm9/0qB65hk8@J5cw1T4D1Zw3uBH/KSfNE7ReSxIso@DQej@WVjuRXIxahxTYXVWap@0yT4NBMuHu7vicf2Iq3iR55fMSn76UlOa1QRH1dNv "Python 3 – Try It Online")
Works by replacing the relevant parts by the respective parts of the next verse.
After the preinitialisation, `T` is `['8', '9', 'and all of the little ducks', 'One little duck', 'but none of the little ducks', 'Two little ducks', 'but only one little duck', 'Three little ducks', 'but only two little ducks', 'Four little ducks', 'but only three little ducks', 'Five little ducks', 'but only four little ducks', 'Mother duck herself']`.
# Alternative [Python 2](https://docs.python.org/2/), 252 bytes
*by @ovs*
```
lambda s:reduce(lambda s,a:s.replace(*a),zip(T[2:]+T,T),s)
T="8:9:and allHO1BnoneHT2No1T3Nt2F4Nt3FiveINf4MotherD herself"
for r in "H of theI,4ourI,3hreeI,2woI,1neL:,ILs:,L littleD,D duck,NBonly ,Bbut ".split(','):T=T.replace(r[0],r[1:])
T=T.split(':')
```
[Try it online!](https://tio.run/##vZRBj9owEIXv@RUjX0haF5VApdZSDosQIhLNbrW@QQ5m44ioxo5sB0T/PB1Dtuou2va05GDJfpPnbyy9aY9@a3R6qrP1SYndphLgmJVV9yTj5z0VzA2tbJXAww8iob@aNuarlJUfOeUJdUnEM/KVfWNCVyCUWtyPptpoueBpYUZ8XPh0Pin8eN7sZV7Uk@/Gb6WdAS5OqppEtbFgodFAFmBqQDWnE9PZnI63VuImPZicjrRcMpovHaNLUI33Ss7oDJD1Jy2mRqsj0Omm80CGrkU9HtBBwnjG/8Db1eeS2tWIlQGZP5exQXLaBxaXEUICZW9/9nZwkNqDQWPsCSpxpJHB8oAJ20YpB6HvrgVxEMdhdOkOZvgrONFUFMiPTuDmaiU02pxdkbzGdl/e@iR2EjZYNoyi@ZV6CyYfHv9tKH4t34TqYP7B9Fq8BVGw/uvSF0D3r7R35gmx6yP09iP1rmeePoPvydVPhf9gYfL6PJK1XmuSROex0NB9GAxSdztphZfxJagJiwC/1jaIXcf7BAnmD3d3@ePykazCQZZdKlfNpy8lY2lJ0ZecfgM "Python 2 – Try It Online")
[Answer]
# [QuadR](https://github.com/abrudz/QuadRS), ~~257~~ 242 bytes
-14 thanks to Black Owl Kai, -1 thanks to Kevin Cruijssen
```
ive
Four
hree
Two( little duck)s
One little( duck)
Mother( duck) herself
four
two( little duck)s
only on(e little duck)
but none
and all of the
our
Three
wo
One\1
Mother\1 herself
Five little\1s
three
one\1
none of th\1s
and all
but only four
```
[Try it online!](https://tio.run/##ZZDNasMwEITv@xRLTi6YgN@h@FZKIEdfNvEamyraVj82fnpnJYsmIRehHc1@M@gvUu@2bZoZWokORscM50UqNFMIhrGP158PD9@Wi1LtEnxJGNmVCfXq2QwwJEh43xdrVhRb8YsOlxjQimUg2yMZgzKgYiFRzrnLIim7a0pe1/xHtVq60LrGQ8h2yd6E3FHppbBzWO6RSm5b5j/X8biwVUu2qURrDTKzS41wnIzxmFDxF2mh9Vga4aeuoqepr/FwiqTD23moH@H6Oa@hV7oxXtR1vAM "QuadR – Try It Online")
[Answer]
# T-SQL, ~~407 390 388~~ 382 bytes
```
DECLARE @ CHAR(999)=REPLACE(REPLACE('SELECT CASE LEFT(v,2)WHEN''Fi74,''Four''),122,4,''three'')WHEN''Fo74,''Three''),123,5,''two'')WHEN''Th75,''Two''),121,16,''on#'')WHEN''Tw716,''On#''),115,20,''none of th#s'')WHEN''On715,''Mother duck herself''),115,8,''and all'')WHEN''Mo719,''Fiv#s''),113,14,''but only four'')END FROM i',7,'''THEN STUFF(STUFF(v,1,'),'#','e little duck')EXEC(@)
```
Input is via a pre-existing table \$i\$ with `VARCHAR(MAX)` field \$v\$, [per our IO rules](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods/5341#5341).
After a couple of byte-saving `REPLACE`s, executes the following as dynamic SQL:
```
SELECT CASE LEFT(v,2)
       WHEN'Fi'THEN STUFF(STUFF(v,1,4,'Four'),122,4,'three')
       WHEN'Fo'THEN STUFF(STUFF(v,1,4,'Three'),123,5,'two')
       WHEN'Th'THEN STUFF(STUFF(v,1,5,'Two'),121,16,'one little duck')
       WHEN'Tw'THEN STUFF(STUFF(v,1,16,'One little duck'),115,20,'none of the little ducks')
       WHEN'On'THEN STUFF(STUFF(v,1,15,'Mother duck herself'),115,8,'and all')
       WHEN'Mo'THEN STUFF(STUFF(v,1,19,'Five little ducks'),113,14,'but only four')END
FROM i
```
Uses a `CASE` statement and `STUFF` commands to insert/overwrite characters at the listed positions.
**EDITS**:
1. Replace original (below) with an entirely different strategy
2. Saved two bytes by switching to `LEFT` instead of `SUBSTRING` and eliminating a space
3. Saved 6 bytes by changing variable to `CHAR` and moving an extra letter into the second `REPLACE` (thanks, @CDC!)
Here's my first version, using a different method (post-replacement, formatted):
```
DECLARE @ VARCHAR(MAX)
SELECT @=v FROM i
SELECT @=REPLACE(@,PARSENAME(value,2),PARSENAME(value,1))
FROM string_split('e.but none.and all
                  -e.One little duck.Mother duck herself
                  -o.only one little duck.none of the little ducks
                  -o.Two little ducks.One little duck
                  -r.two little ducks.one little duck
                  -r.Three.Two
                  -u.three.two
                  -u.Four.Three
                  -v.four.three
                  -v.Five.Four
                  -t.and all of the.but only four
                  -t.Mother duck herself.Five little ducks','-')
WHERE LEFT(value,1)=SUBSTRING(@,3,1)
PRINT @
```
`STRING_SPLIT` and `PARSENAME` are used to break a string into rows and columns via `-` and `.` separators.
The first column is a key character that is matched against the 3rd letter of the input verse (thanks for the idea, @Night2). The second and third are the replacements being performed for that verse.
[Answer]
# Java 10, 347 bytes
```
s->{String L=" little duck",M="Mother duck herself";int i=9;for(var t:("ive;Four;hree;Two"+L+"s;One"+L+";four;two"+L+"s;only one"+L+";but none;and all of the;"+M).split(";"))s=s.replace(t,++i+"");for(var t:("Five"+L+"s;but only four;and all;none of the"+L+"s;one"+L+";three;"+M+";One"+L+";wo;Three;our").split(";"))s=s.replace(i--+"",t);return s;}
```
[Try it online.](https://tio.run/##vZVNi9swEIbv@ysGnWz8QU@FRriXLguFzYayuTU9KLay0a4iGUm2CYt/ezrWKmmy2SSl0FyMPl7mfWYGjZ9Zy7Ln6mVTSmYtjJlQrzcAQjluFqzk8DBsAR6dEeoJyigsbEzxvL/Bj3XMiRIeQEGxsdnX1yC5LwhI4ZzkUDXlC0nHBRlrt@TG7wEXlssFoWgGovhCF9pELTPgRhERLad3ujF0aTin006T5D4hlk4U9ysU46XbnWsl16C3l/PGgcIdZaoCJiXoBaAxJck4zm2NVBGhJI5tYXPDa4mJRi5NEpEQEh9w3CFIsBiCehtvHSLTwSaE36EECufZ0RPXO@5O06k/xyDkJIzIMkRJXUwNd41RYGm/GSpeN3OJxQ41b7WoYIU9C235@QtY/NawIYnQCMet@8YshxEo3sFW@qYD8Dnud8pCx7El2ueLR2ydzpRusW@YJCyFlBaG9JsaWMfW@UyFtt4ObbVMVCnMyI@G4e7oOyMY7KCUh9YlW3GYozAn6Q7wSHU1QN/Dy4TTY9n1EDv9F4DvRVfDG@LvOX9IN3mnuQbc3sO9XL4P5tZ/hzycXScZPWIfb1/z49o6vsqRK6/xnTupIj@qT9yR72oE5JxiOz3Oac46TBp3wULl5R@bf/bJyDA@OXPR50/bKL3/SfWb3w)
**Explanation:**
We first replace all parts one by one with integers in the range \$[10,21]\$, and then these integers back to their replacements. The reason this is done in two steps, is because we would otherwise replace replacements.
```
s->{                     // Method with String as both parameter and return-type
  String L=" little duck",M="Mother duck herself";
                         //  Two temp strings to save bytes
  int i=9;               //  Temp replacement integer, starting at 9
  for(var t:("ive;Four;hree;Two"+L+"s;One"+L+";four;two"+L+"s;only one"+L+";but none;and all of the;"+M).split(";"))
                         //  Loop over the parts to replace:
    s=s.replace(t,       //   Replace the part,
                ++i+""); //   with the integer pre-incremented by 1
  for(var t:("Five"+L+"s;but only four;and all;none of the"+L+"s;one"+L+";three;"+M+";One"+L+";wo;Three;our").split(";"))
                         //  Then loop over the parts to replace with in reverse:
    s=s.replace(i--+"",  //   Replace the (post-decrementing) integer,
    t);                  //   with the replacement-part
  return s;}             //  And then return the modified String as result
```
[Answer]
# [Python 2](https://docs.python.org/2/), 1034 bytes
This is my code! It employs a simple dictionary. After running this code, you can enter any verse and it will output the next verse.
PS: I am new to this channel and this is my first post. I really liked this challenge so decided to give it a try. Please feel free to correct me.
```
import sys
i=sys.stdin.readlines()
s={"Mother":"""Five little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only four little ducks came back.""",
"Five":"""Four little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only three little ducks came back.""",
"Four":"""Three little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only two little ducks came back.""",
"Three":"""Two little ducks went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but only one little duck came back.""",
"Two":"""One little duck went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
but none of the little ducks came back.""",
"One":"""Mother duck herself went out one day,
over the hills and up away.
Mother Duck said, "Quack Quack Quack Quack",
and all of the little ducks came back."""}
print s[i[0].split(" ")[0]]
```
[Answer]
# [PHP](https://php.net/) (7.4), ~~253~~ 247 bytes
-6 bytes by improving how the replacements array is built with more help from "Unpacking inside arrays".
```
<?=strtr($argv[1],array_combine([0,1,...$a=[Five.$l=($o=" little duck").s,($b="but only ").four.$l,Four.$l,$b.three.$l,Three.$l,$b.two.$l,Two.$l,$b.one.$o,One.$o,"but none of the$l","Mother duck herself","and all of the$l"]],[...$a,$a[0],$a[1]]));
```
[Try it online!](https://tio.run/##bVDBaoUwELz7FUvIQWEJz3MrvZR3K6XQm0hZNVZpXiJJVPx6u/peaUt72dmdDLOzGftx2@4fihB99Kkk/z6XeYXkPa1vjbvUg9VpecIclVKSivI8zFpJU6TSFQLMEKPR0E7Nh8hUwFTWhainCM6aFZjq3ORZjucbylrF3uvdAl@/mp1c3EFdgQln@cnh8xUOT8scuA5ir6URKJ4cd/5YDtwEbTpmybZAxnwLqwrLIzxKKk/VXvOqyrK7bdv@sYBFW85/3MCX0YqJm1nDQugHYwLsG6YRaKFVJTeHx90h0NAiiJeJePhTBSa/s/38vQANXTTUrFOf "PHP – Try It Online")
This creates an array of every possible replacement (12 used + 2 unused) in a `key=>value` format. Example: `['Mother duck herself' => 'Five little ducks', etc...]` and then just replaces those using [strtr](https://www.php.net/manual/en/function.strtr.php).
The only interesting thing is my first ever usage of ["Unpacking inside arrays"](https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.core.unpack-inside-array) which is a new feature in PHP 7.4.
---
# [PHP](https://php.net/), 264 bytes
```
<?=str_replace(($a=[[Five.$l=($o=" little duck").s,($b="but only ").four.$l],[Four.$l,$b.three.$l],[Three.$l,$b.two.$l],[Two.$l,$b.one.$o],[One.$o,"but none of the$l"],["Mother duck herself","and all of the$l"]])[$i=strpos(vuroet,($v=$argv[1])[2])],$a[++$i%6],$v);
```
[Try it online!](https://tio.run/##bZDNSsUwEIX3fYohRGi5oaALNxrcyN2JCO5CkbRNbTA2JX@lT1@nuV1c0U04@eYwM2fmcd62xyfug/twajayU2VJJRfirJOqqeEltZyA0SEYBX3svkhVe1bSlpM2BrCTWQHRYKNDe8PE@aIYbeswOqUu9P2QGS/2gFnsyE5YtIhes2C594QU7ABhVNQQLJIXi9rlNQCFV2YgjMipB2nMlbWpBNV7qNn6MkVnVcCVE6fSfSZxi@W7pmoYleJ0ovrmHmWqHrZt@2cALGrCnDkrXkCurLAJPWiEURvjYZ8fZ5CLXOvi6PC8d/BS9wzIW5T4@fMSVvze/PrKHjr5raBFX/0D "PHP – Try It Online")
I have stored different words of each verse in an array. I find which verse the input is using third character of the input as it is unique (`vuroet`). Then I simply replace different words of that verse with different words of the next verse.
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), 352 bytes
```
import StdEnv,Text
$n={#"Five"+e+"four"+d,"Four"+e+"three"+d,"Three"+e+"two"+d,"Two"+e+"one"+a,"One"+a+b+"but none"+f,"Mother duck herself"+b+"and all"+f}.[indexOf{n.[2]}"tvuroe"]+" came back."
a=" little duck"
b=" went out one day,\nover the hills and up away.\nMother Duck said, \"Quack Quack Quack Quack\",\n"
d=a+"s"
e=d+b+"but only "
f=" of the"+d
```
[Try it online!](https://tio.run/##ZZDBbsIwDIbvfQrL49bSw@69MaRJm9gEN8rBNMmISJ2qTQsV4tXXOWU7TYri378sf7Yrp4mn2qveaajJ8mTrxrcBtkG98JDt9DUkCy5uT7i2g8ZUp2h832KqMlzPQpxwarWerd1DRe/iH06MknsWnzLczDE9pnjsA/BsmwzffTjpFlRfnUFEp53BWESsgJyTmnu@t6z0dWNunO@fD3cMQ996jYcUoaJaw5Gqc44JFQjOhiAbxXaYHMW4aA7ghShAUDRmJftBgEKFk3Wug0jqG6ALjXnJv/Os4jwdWZVBiZ@9AODfX6I0w0QVlGKHiS7U33ae3QiYGOF7E1FykWkbSO5bwALiLfI8x@m7Mo6@umn5@jatRqbaVo/kw1Ewvq2npZPXMTXN@AM "Clean – Try It Online")
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), 262 bytes
```
x=>$@"{l[g=x[2]*37%724%7]}{g-5:; little} duck{g-4: herself;s;\} went out one day,
{(x=x.Split('\n'))[1]}
{x[2]}
{g-5:and;but} {g-4:all;only;none} {(g>3?"of the":l[g+1].ToLower())} little duc{g%3:ks;;k} came back.";var l=" Four Three Two One Mother".Split();int g
```
[Try it online!](https://tio.run/##bZFNb8IwDIbv/RVWNEQ7GBpfQmpW4DBxYpqmIe0AHEKblqhZMiUtUFX97cxhO4C2Q@LIsl8/rxPbh9iK86JU8VNSKfYp4q4tjFDZNI3Op2h6Nye1XGfRaT3Y3g8nrclg1Jpsmzp7GIcUpCgKyRtIyjjH1CiEPTeWy5RaumngyFUBusSjOCSs6nq1f4pOvfcvbPTbG9UOgnV/23i1k8fgVJlK6K4sGrgIMimpVrKiCjUw52fT4YzoFIo9JyGSdfrb3kov9ZEbPwiaXyRHVGetYZhbSvMGYvbJYcfivEfogRmQEYGFLg2s9oZzWB01vCLji0ZZQ34BAyqQPztT72clwCCCOVmIA78ak9t/fOoDNw4R9kJKC@gJyi9gR1b1vJ8h8IytYJlIukDIW4ls8OcmpOvtLrqygtTx3sy9duV9GFHwpVDcZwH1Um18Ry8Q@ZFieIIxhk4ngPqqFCudqfTSc6vQnLMoGs3c3kN8jWf4FaED@QY "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [Stax](https://github.com/tomtheisen/stax), ~~115~~ 111 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
τ*^&k─Zè0µ9┬$█◘çl╟☼:Drσ59ò╠▄┴╢Q♂╔¡ô╜Oa╣▀yèA÷╨%^♀█Ö+╡◄ì=∙%╧o▌Θ<▲Çα¿╗√;1°┼╤V◘ú┐♥▒ÇM☼b╩░o]YaL4░ƒ%(Æ♫Q0æÆä⌂¡╘○Eâó╪¡
```
[Run and debug it](https://staxlang.xyz/#p=e72a5e266bc45a8a30e639c224db08876cc70f3a4472e5353995ccdcc1b6510bc9ad93bd4f61b9df798a41f6d0255e0cdb992bb5118d3df925cf6fdde93c1e80e0a8bbfb3b31f8c5d15608a3bf03b1804d0f62cab06f5d59614c34b09f2528920e51309192847fadd4094583a2d8ad&i=Five+little+ducks+went+out+one+day,%0Aover+the+hills+and+up+away.%0AMother+Duck+said,+%22Quack+Quack+Quack+Quack%22,%0Abut+only+four+little+ducks+came+back.&a=1&m=1)
[All the verses as test cases](https://staxlang.xyz/#p=e72a5e266bc45a8a30e639c224db08876cc70f3a4472e5353995ccdcc1b6510bc9ad93bd4f61b9df798a41f6d0255e0cdb992bb5118d3df925cf6fdde93c1e80e0a8bbfb3b31f8c5d15608a3bf03b1804d0f62cab06f5d59614c34b09f2528920e51309192847fadd4094583a2d8ad&i=Five+little+ducks+went+out+one+day,%0Aover+the+hills+and+up+away.%0AMother+Duck+said,+%22Quack+Quack+Quack+Quack%22,%0Abut+only+four+little+ducks+came+back.%0A%0AFour+little+ducks+went+out+one+day,%0Aover+the+hills+and+up+away.%0AMother+Duck+said,+%22Quack+Quack+Quack+Quack%22,%0Abut+only+three+little+ducks+came+back.%0A%0AThree+little+ducks+went+out+one+day,%0Aover+the+hills+and+up+away.%0AMother+Duck+said,+%22Quack+Quack+Quack+Quack%22,%0Abut+only+two+little+ducks+came+back.%0A%0ATwo+little+ducks+went+out+one+day,%0Aover+the+hills+and+up+away.%0AMother+Duck+said,+%22Quack+Quack+Quack+Quack%22,%0Abut+only+one+little+duck+came+back.%0A%0AOne+little+duck+went+out+one+day,%0Aover+the+hills+and+up+away.%0AMother+Duck+said,+%22Quack+Quack+Quack+Quack%22,%0Abut+none+of+the+little+ducks+came+back.%0A%0AMother+duck+herself+went+out+one+day,%0Aover+the+hills+and+up+away.%0AMother+Duck+said,+%22Quack+Quack+Quack+Quack%22,%0Aand+all+of+the+little+ducks+came+back.&a=1&m=1)
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~356~~ ~~343~~ ~~340~~ 336 bytes
```
param($p)$l,$M=' little duck','Mother duck herself'
("ive!our;four!three;hree!wo;Four!Three;two!one;s c! c;Two!One;s w! w;only one!none of the;k c!ks c;One$l!$M;but none!and all;$M!Five$l`s;and all of the!but only four"-split';')[$(switch -r($p){^Fi{0,1}^Fo{2,3}^Th{2,4,5}^Tw{6..9}^O{10,11}^M{12,13}})]|%{$p=$p-creplace($_-split'!')}
$p
```
[Try it online](https://tio.run/##vVRNa@MwEL3rV4yMsrapYpp@LOyKQA9LbiYs5FaaVnUUbKJaXn/UG1T/9nRkzJI0ZXNqLiPPmyfNm5FHhWlVWaVK6x1bwxTsrpClfAlYETLNWTz1QWd1rRWsmmTjcz82darK3gP8qJRe@yTwsldFTVOKNRpap6VSwhnaGjFz0KKH6tZQkytRQUIhEQt0573bUmiFyfUWMExzNGDWgJnEBqkb5AskMk1ZLJ6bGhyDynwFUmvBYjrD/Ew/VWLAht3UcftjnS5vXBVYjC/88J4FVZvVSQrj0tVql7PMXvJJt5wZe8Wvu@UixfWG3@JXa79H0Y9uObcTpCAntpMrPrnuuvDhbWRZMWXFOClVoWWiAvY4pKF@2BFW7DpC2KvrVIX9vfOJ07rfVKxe5Sizl4qQ3HJicIMrANJM6wpcVU0BspXbiAw38MvdQCWzFQfvdyPRObIeJwcNOMyayBcFz0iLiH/He2VHnHMo6/@WU9IWx6SzaGvNSWUfKefQ5Y7eS/qJrPkHxher2hvZUw375AX5SnWHL8J/xOGYZjihl/@m9Q1GYAlAD19c4DKCIRYlpslrF/uLsQG8Z9mDg0qEvgE@p@wRXY8FSBqrPxgIfz7lzJadRzqyewc).
**More readable version:**
```
param($p)
$l, $M = ' little duck', 'Mother duck herself'
$replacements = @"
ive!our
four!three
hree!wo
Four!Three
two!one
s c! c
Two!One
s w! w
only one!none of the
k c!ks c
One$l!$M
but none!and all
$M!Five$l`s
and all of the!but only four
"@ -split '\n'
$i = switch -regex ($p) { ^Fi { 0, 1 }
                          ^Fo { 2, 3 }
                          ^Th { 2, 4, 5 }
                          ^Tw { 6..9 }
                          ^O  { 10, 11 }
                          ^M  { 12, 13 } }
$replacements[$i] | % { $p = $p -creplace ( $_ -split '!' ) }
$p
```
[Answer]
# [PowerShell](https://github.com/TryItOnline/TioSetup/wiki/Powershell), ~~265~~ ~~263~~ ~~255~~ ~~251~~ 246 bytes
```
$d='Five1four2s,Four1three2s,Three1two2s,Two1one2,One23but none52s,Mother duck herself3and all52s'-split','
'2s34',' little duck',-join($args-split'(\s)')[5..39],'but only ',' of the'|%{$d=$d-replace++$i,$_}
$d[+"$args"[2]*37%724%7]+' came back.'
```
[Try it online!](https://tio.run/##vVTBbuIwEL37K0apWcNiUJOA0B6QOKx6W1Ur9cZGlZs4Ja2Js3FCFlG@nR2HhM2WSpxKDvb4zYzf80Qzma5kblZSqQON57sDjebsLtlIN9Zl7hl@h5tbrHIp8fBgd7eotLUr7epUevweF/@pLCDF4xQ9P3SxkjlEZfgKaBipYl@kEQil0M1GJlNJwTgjzDP@BA3Ac6FkncH46EUnaZ@K/Nk0of1fZsAGy@l47H8LOLNcOlVbsKk6BmRjb70dKqfRKJeZEqEcDmnC6eOe0Gg5dOrLnKUXfPVnvZk36c2CIYNQrCU8ifB1zA57QqjR6TPMYeEQW4CuKAOVTJG0JkZIbDnRG3wjUsMqUcqAfWCZgajEdkyaCny3FTAiiTg4P0skgrPV4eT0HFvx/1n/KSTOglthZyHXEFb//gvKHs5jriKt0peEvY@4hix7dYf0XNX9u4BPFmVbs2mVC@X6oHk/U1wzFy5rI2TRJ4T36y5dTgN@NG6DwQm8bUG3A7ot6HVArwX9Dui34KQDTlpwiiAZwBv0YEcAP7qx1eFA5Z9MhoWMcHTQx6Mrl6ZUBQJfaNwEdh2jUP4@pdWOmzblBso01Ou1rXihIUpwAootNN7jTfvDXw "PowerShell – Try It Online")
I used the brute force to find the expression `+"$args"[2]*37%724%7`.
```
 verse | 3rd char. | ASCII code | *37%724%7
-------+-----------+------------+-----------
   0   |    'v'    |     118    |   1
   1   |    'u'    |     117    |   2
   2   |    'r'    |     114    |   3
   3   |    'o'    |     111    |   4
   4   |    'e'    |     101    |   5
   5   |    't'    |     116    |   0
```
Thanks [@Arnauld](https://codegolf.stackexchange.com/a/193474/80745) for the `3rd char`.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 134 bytes
```
“€µ‚•„í†ìˆÈ“#’ „ê Ðœs’δJć¨…î¥Ðœº¶s‚ìðδJD…€³€É δì¨¦“€ƒ€Ÿ€‚€€““€³Šª€‚€€“‚’ „ê Ðœs ’δJì…‹é‚ƒ.δJU.•4Ôāl•|н2èk©è.ª?I„ 
ý#3.$17£ðý„ 
¶:,X®è?
```
[Try it online!](https://tio.run/##ZU9NSwJRFN3Pr7hoy2GgDwjauJGgoEWLoO1TXzg4OjEfykCLV4s@dmFtEgkpklEmETSpwM276iaQfsP7I9MdbVMu3uHec@495z7bZTmTx7ESTXURyTclGko8KfGIr0q0MPq6xGvS0ko8QMJ2AW@ndy618@H@5EqGSrSxJ18SVn7KESkNjLBPapakxHNAgDcwH2IkQ9leJs3qBNN3giSRMCmav1cMpi3ZXZEa/26A5REYJTniAzs0MqsbRB0Z9IctvJ@cW1ScfY83MCzJDoaG7Gb2yAI0HKc3jbX1bfmMfRwvKDna0Y9lD8NMHO@aVQ6W6XkWh4KfL7lQ4xUPbJ9ehSgW6Jpd5Q54RQ5F07JcYJUC@KfAaiwwtAObBAeytAouMws6pA59Rs0KpnQtt3C1Ajixfedvap6VOeRozPgB "05AB1E – Try It Online")
Since i'm relatively new to 05AB1E, this can maybe be golfed a lot
```
                ### Preparation of the output strings ###
“€µ‚•„í†ìˆÈ“        push "one two three four five"
#                   split that by spaces
’ „ê Ðœs’           push " little ducks"
δJ                  join each number with " little ducks"
ć¨                  separate "one little ducks" and drop the "s"
…î¥Ðœº¶             push "mother duck herself"
s                   swap it with "one little duck"
‚ì                  prepend both strings to the list ["mother duck herself", "one little duck", "two little ducks" ... ]
ðδJ                 append a space to each list entry
D                   duplicate it
…€³€É               push "but only "
δì                  prepend "but only " to each list entry
¨¦                  drop the first and last list entry
“€ƒ€Ÿ€‚€€“          push "and all of the"
“€³Šª€‚€€“          push "but none of the"
‚                   push the two strings into a list
’ „ê Ðœs ’δJ        append " little ducks " to each
ì                   prepend it to the sentence list ["and all of the little ducks ", "but none of the little ducks ", "but only one little duck " ...]
…‹é‚ƒ.              push "came back."
δJ                  append that to each list entry
U                   save that list in X for later use
                ### Determine which verse has to be answered ###
.•4Ôāl•             push "eoruvt"
|н2è                get the third letter of the input
k                   get the index of that letter in "eoruvt". Now we know which verse we must return
©                   save that index in ® for later use
                ### Print the answer strings ###
è.ª?                print that index of the first sentence list (first three words of answer)
I„                  join the four input strings by <space><newline>
ý
#                   split that by spaces
3.$                 cut off the first three words
17£                 keep only the next 17 words
ðý                  join remaining words by spaces
„ 
¶:                  replace <space><newline> by only <newline>
,                   print that ("went out ... Quack\",") 
X®è?                print the last line of answer
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt) v2.0a0, 143 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
Tried encoding a single verse with replacements but, in the end, adapting [Arnauld's solution](https://codegolf.stackexchange.com/a/193474/58974) ended up being shorter. Have another idea that might, hopefully, work out shorter again but don't know when I'll get to try it.
```
tBn)i`Fr4È(e3
Two4e0
MÇ@r Ýõ Êelf1d a¥23
O01¿t Í
23
TËG4two3
Five4fr3`·g`v`b¢Î)r\dÈ°g[V=` Ò¤ Ýõ`W=Uf/ w.*\n/s `  e`V±'sV+W+`¿t § `]
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=2.0a0&code=dEJuKWlgRoxyNMgoZTMKVHdvNI1lMApNx0ByIN31IMoEZWxmMYRkIGGlMjMKT5owMb90IM0KMjMKVMtHNHR3bzMKRml2ZTRmjHIzYLdnYHacjGBios4pclxkyLBnW1Y9YCDSlaQg3fVgVz1VZi8gdy4qXG4vcyBgII8gkGVgVrEnc1YrVytgv3QgjacgYF0&footer=K1I&input=WwonTW90aGVyIGR1Y2sgaGVyc2VsZiB3ZW50IG91dCBvbmUgZGF5LApvdmVyIHRoZSBoaWxscyBhbmQgdXAgYXdheS4KTW90aGVyIER1Y2sgc2FpZCwgIlF1YWNrIFF1YWNrIFF1YWNrIFF1YWNrIiwKYW5kIGFsbCBvZiB0aGUgbGl0dGxlIGR1Y2tzIGNhbWUgYmFjay4nCgonRml2ZSBsaXR0bGUgZHVja3Mgd2VudCBvdXQgb25lIGRheSwKb3ZlciB0aGUgaGlsbHMgYW5kIHVwIGF3YXkuCk1vdGhlciBEdWNrIHNhaWQsICJRdWFjayBRdWFjayBRdWFjayBRdWFjayIsCmJ1dCBvbmx5IGZvdXIgbGl0dGxlIGR1Y2tzIGNhbWUgYmFjay4nCgonRm91ciBsaXR0bGUgZHVja3Mgd2VudCBvdXQgb25lIGRheSwKb3ZlciB0aGUgaGlsbHMgYW5kIHVwIGF3YXkuCk1vdGhlciBEdWNrIHNhaWQsICJRdWFjayBRdWFjayBRdWFjayBRdWFjayIsCmJ1dCBvbmx5IHRocmVlIGxpdHRsZSBkdWNrcyBjYW1lIGJhY2suJwoKJ1RocmVlIGxpdHRsZSBkdWNrcyB3ZW50IG91dCBvbmUgZGF5LApvdmVyIHRoZSBoaWxscyBhbmQgdXAgYXdheS4KTW90aGVyIER1Y2sgc2FpZCwgIlF1YWNrIFF1YWNrIFF1YWNrIFF1YWNrIiwKYnV0IG9ubHkgdHdvIGxpdHRsZSBkdWNrcyBjYW1lIGJhY2suJwoKJ1R3byBsaXR0bGUgZHVja3Mgd2VudCBvdXQgb25lIGRheSwKb3ZlciB0aGUgaGlsbHMgYW5kIHVwIGF3YXkuCk1vdGhlciBEdWNrIHNhaWQsICJRdWFjayBRdWFjayBRdWFjayBRdWFjayIsCmJ1dCBvbmx5IG9uZSBsaXR0bGUgZHVjayBjYW1lIGJhY2suJwoKJ09uZSBsaXR0bGUgZHVjayB3ZW50IG91dCBvbmUgZGF5LApvdmVyIHRoZSBoaWxscyBhbmQgdXAgYXdheS4KTW90aGVyIER1Y2sgc2FpZCwgIlF1YWNrIFF1YWNrIFF1YWNrIFF1YWNrIiwKYnV0IG5vbmUgb2YgdGhlIGxpdHRsZSBkdWNrcyBjYW1lIGJhY2suJwpdLW1S) - includes all verses
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 156 bytes
```
≔⌕tvuroe§θ²δ§⪪”↶0∨↘»≔xj➙⌈´βＸPＮLA‽⟦O⧴＆▷V'¦³≧ψZρ⊞t”¶δＦ‹δ⁵”↶↧V4ⅉＨ‴G%”Ｆ‹δ⁴s⮌…⮌θ¹⁸⸿η⸿ζ⸿§⪪”}∧h⁴ＮＱ≕Q^⪫ΦＧ✂q'ⅉＭG./_⸿s⁵6P⁴″⊟±ＮNpOfBz↷Ｆι‖ＴM→⁻γ？k⁴ς!d⁵º'E,θ}x§-υ”¶δ✂ε±¹¹
```
[Try it online!](https://tio.run/##fVFBTsMwELznFSufHClUKgIJiVNVFAkJKNAec3GTTWNh7NZ2EsLnwyaFlIaWi2XP7M7sjtNC2NQI1bYz5@RG81jqjDNfldYgi2Dm73WGH3wXwWUYRpCFt8GzldrzH2a5VdJzFssKEx2b0iZ6VVikx6o2iV5ouj0aX6CFrEzfgC4OVU7aLNGslyTN3FjgD@gczyK4DkPYmzAgca@wb2XjuqtDnWPDYK9YdRZ83qQK54XZDsiO3KY3YTiUssQe@orT8OdpeLT@uvRgtGogpwR@D@0SPXC@y@UsWZtzlNFHXXtGd6jJSXQsKXQGQqlT5Cj1/SpLJVPkGMETboRHPp12EbXt4tgWatQ0UD8UIaKJAkO59h6FVMpBZ1xuQdSimQTff37XdToh6bvYSyno8edkUfDfQpCKd4Q1FU7ai0p9AQ "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
≔⌕tvuroe§θ²δ
```
Look at the third character of the first line to work out which verse we want.
```
§⪪”↶0∨↘»≔xj➙⌈´βＸPＮLA‽⟦O⧴＆▷V'¦³≧ψZρ⊞t”¶δＦ‹δ⁵”↶↧V4ⅉＨ‴G%”Ｆ‹δ⁴s⮌…⮌θ¹⁸
```
Output the first part of the first line by indexing into the list of strings `Five`, `Four`, `Three`, `Two`, `One`, `Mother duck herself`. Then print `little duck` and `s` as appropriate, followed by the last 18 characters of the input line (which are always the same on each verse).
```
⸿η⸿ζ⸿
```
The middle two lines are always the same on each verse.
```
§⪪”}∧h⁴ＮＱ≕Q^⪫ΦＧ✂q'ⅉＭG./_⸿s⁵6P⁴″⊟±ＮNpOfBz↷Ｆι‖ＴM→⁻γ？k⁴ς!d⁵º'E,θ}x§-υ”¶δ✂ε±¹¹
```
For the last line it turns out to be golfier to include `little ducks` in the list of alternatives for some reason, but the last 11 characters are still copied from the input.
[Answer]
# [Bash](https://www.gnu.org/software/bash/), ~~373~~ 355 bytes
Nothing too crazy here. An easy few byte reduction would be to replace the two-character variables (a1,a2,a3,e1..e6) with single character ones.
```
read a{1..3} b
read c
read d
read e{1..6}
W="$e1 $e2"
X="${e3^} $a2 $a3"
Y="$e5 $e6"
Z="$e4 $Y"
p=$X
case $a1 in M*)p="Five ${Y::12}";s="but only four $Y";;O*)p="${d::11} herself";s="and all of $Z";;Tw*)p=${X/s};s="$e1 none of the $a2 ducks $e6";;Th*)s="$W one $e4 duck $e6";;Fo*)s="$W two $Z";;Fi*)s="$W three $Z";;esac
echo $p $b;echo $c;echo $d;echo $s
```
[Try it online!](https://tio.run/##ZZDLasMwEEX3@opBaJMQXJy0WcR4V7ILpVDIY1GQ5QkyVS1j2THB@NvdkewWQhfSPO6RdEeZdHoca5Q5yD6Oos0AGQulmkI@BfTidmDHlAuMQeCasxPlPW4@BxByTWvD2dnLLyRvObv4/BnEmbMqFSempEOiYihKOCwXVcr3xY06/Xm3i9cDT1zKs7YBW5o7XG1b@6NJ8hZQ0edExQNorB2aa6BlSa6NAXsFcSH0o/Os6E9PbvC6d1raEj3QaAw281Z9uWCQeL1ceOwIHvJmvTqLe/srNp2d7t8Xfy1dI05NdFIxVJqYCkSWTKmaYz5HN45hWlM0jcHZRYcljRtGppa8r5i9YR2s6sIYB37AtgLZyXvEDpaEGl69RSeLfAX8vZVU/Nv5ij1@5MOrSn4jZIRFPw "Bash – Try It Online")
~~[Try it online!](https://tio.run/##ZZDBasMwDIbvfgphfFhHyUi79dBQ2GH0VkZh0HaHgeOoOMyLS5w0lOBnzyynO4QdLFn6P@FfzqXTw7B/mPUMlbYgXplnNcoCZJ8mydJDPpZqTMWYkMSVZ4cNF5iCwAVnx3DvcfnlQchFOEvOTiS/BHnF2Sfdn0GcOFPSYQBSKCu2e5xdNnxbXkOnP63X6cLzzG143jZgK3ODs21rmsoy9h5Z0RcBSz1orB2ac8RlFRwbA/YM4pPYj45g0R@fnCeAbFa2QiIajdFj0apvF93RgI4DxwgfgFDyS8wfsrUTpOns/bFtORV0jThK6KRiexAXEHkWsqJQUHDDELc2ZdMYvHvpsAprx9VDS97mzF6xjoZ1aYwD2rO9gOzkLWE7G4Qa3siik2UxB75vZSj@RT5n0w@dvKrkD0IesOQX "Bash – Try It Online")~~
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 247 bytes
```
{S:i/ne\sl.*?<(s//}o{m/..(.)(\S*)**3%\s(.**92).*(.**11)/;[(my$l=" little ducks")~$3 XR~"Mother duck herself$2and all of the","One{$l~=$2}but none of the","Five{$l~="but only "}four","Four{$l}three","Three{$l}two","Two{$l}one"]["eotvur".index($0)]}
```
[Try it online!](https://tio.run/##vZTNa4MwGMbv/hUvwRUViWsLg32UXUZvo2ztYVB7SGukspiI0Top@q@7xI2t1nW39mLyPk8@fs8LMaEpu2niEgYhTKDZz@8ij1NfMuw8PljS8yqxjz2MLWxb/tyxHWd85UsLO87tyMaOngyHtne/tOLSZBMELMoyRiHIN@8S2bU5hrfXGj2LbEvTVgU1kZSF5ojwAAhjIEJQLnLRjNO9yeqJOarWeQZccPprTqPdl4u0JzgrAVWhyFPtqUF5VbZNqV670GMrFEKXhdCFOg6tloiKbKd24YgH9MMyr@1V1UhSAh6ENfI5glCkIFmeJlgmKo6lRCXbjSbo5IOCcoXS4iiJlK4hdiqmAoZtxJgEHTFPgBSkxMZ3E550EySJAhfQS05U0fsi1/gJqSN2b92QmMJaLcOGMe25l2Bq@3waatG3L0JViH@Yjs1LEOmjDy7tAM2OvDPzHDym003645mek6v7AziF9Qk "Perl 6 – Try It Online")
Definitely golfable, especially the last 5 elements in the list in the form `"num $l num-1"`, or the starting regex that matches the right parts of the old input.
[Answer]
# [ink](https://github.com/inkle/ink), 353 bytes
```
=d(v)
~temp n=(v?"Fi")+(v?"F")*4+(v?"Th")+(v?"T")*2+(v?"O")
{n-1:{n:{n-5:{n-4:{n-3:One|Two}|Three}|Four}|Five} little duck{n-2:s}|Mother duck herself} went out one day,
over the hills and up away,
Mother Duck said "Quack Quack Quack Quack",
{n-1:but {n-2:only {n:{n-5:{n-4:one|two}|three}|four}|none of the}|and all of the} little duck{n-3:s} came back.
```
[Try it online!](https://tio.run/##vZRRa4MwEIDf8yuOPNXNFNZ2L4LuZQz2MMqgj8KwM6I0jUVju1LdX@8uqTCtXVsfVtEjXi5333nnJXKxZx5I/qU@1jzL@YC@JGsOIlFKcAiLz0UOGy4VpAU@ElXB1vZJisagYg5xIkQOgQyhWEGwCbZDn7yluJPBMx6GPEhCG3z6XgT41pE@RWdz41psIUqLrB36M1hymKPhkFrAPHLM2jlwM1YVZ5z3gp11T9yOdpP2Yz22vxmp9t@IfAl0emTejxM6mD65zCm17zQyPvt81DqY4Yy1SkT/zqtPB0JchUtct8lrpEV8Vl/kVa4Q1KghyR2yM8uK@ECmhWrvMS@sHaDjXxdoyjzm7V3ctci34ssVSHewfsKxQ617s6DW3cSsZnGtmqFqZFZTapGdZA/OTuLNHrWYaDF2sBNKbNuqNP9ZVerZgBKnWdVMG21HTl6VJ4pRdatxphh2p8fhr0pQ@wCtm8fEN53eSgEDlkrTqwN9ZOgbnVaV7VIeJzXGpBoV3ZvPfMUsP9duJ/7iMyleNcZ/AA "ink – Try It Online")
First, uses substring checks to figure out what verse we're in - that's easy enough thanks to the capitalisation of the numbers at the start - `F`, `T` and `O` don't occur in any other places, and you can distinguish the second and fourth verse from the first and third by also checking for `Fi` and `Th` respectively.
Then we just do what ink does best and print plain text specked with conditionals. I tried using switch statements at first, but while that looked nicer, it actually ended up longer.  
You'd think the `Quack`s would be a good place to use variables, what with a string being repeated a bunch, but variables come with enough overhead that every way I tried to do that made the code longer. Maybe that's a sign I'm not supposed to golf in ink.
[Answer]
# [Zsh](https://www.zsh.org/), 270 bytes
```
read {a..d}
read e
read f
set `cat`
case $a in
M*)a=Five
b=$5
c=$6
set but only four ${@:5};;O*)a=Mother
b=$c
c=herself
1=and
2=all;;*o)a=One
c=duck
set but none of the ${@:4}
6+=s;;T*)a=Two
3=one
5=duck;;*r)a=Three
3=two;;*)a=Four
3=three;;esac
<<Q
$a $b $c $d
$e
$f
$@
```
[Try it online!](https://tio.run/##ZVDLasMwELzvVyxBl6bB0EdyqCLIofQWQiAfkLW8xqaqVCw5Jg35dnflQCH0Iu3Ozo5m9BObceyYKrxQUVRXmGq@XTVETni0lI5gKTIqwtbDdv5A5qM9MZRGLcEatZqIZZ8weHfGOvQdqsvmbXnVepfZ25Aa7jLfCl/KyK6GJ0O@gmdDzmk9D8LbeZZ51dvPP0UfPGOoUQQmzdcrrB5N1PqQhQ9DgBcjFFhOa6LTZbjpmGWQhiBItiuWcp9xrTmShfV6DxJIlagsqgoUg6pBbcYxZ0PXpuQYs2jEgb1km/IJROcFhBN3k6emdS6iBMH@G2mgcwG3tPguqxiprRY42/ckzb9ztoD7X7t71dIXYym0YvwF "Zsh – Try It Online")
Explanation:
```
# {a..d} expands to a b c d
# so, read four words and assign them to a, b, c, and d
# (d also gets all the extra words beyond the 4th)
read {a..d}
# read two lines and store them in e and f
read e
read f
# assign the words in the remainder of the input
# to the numbered variables 1...
set `cat`
# if the first word...
case $a in
    # starts with M (i.e. Mother)
    M*)
        a=Five
        b=$5  # "little"
        c=$6  # "ducks"
        # set the numbered variables
        # ${@:5} is the existing numbered vars from 5 onwards
        set but only four ${@:5}
    ;;
    # One
    O*)
        a=Mother
        b=$c       # "duck"
        c=herself
        1=and
        2=all
    ;;
    # ends with o (Two)
    *o)
        a=One
        c=duck
        set but none of the ${@:4}
        # "duck" -> "ducks"
        6+=s
    ;;
    # Three
    T*)
        a=Two
        3=one
        5=duck
    ;;
    # Four
    *r)
        a=Three
        3=two
    ;;
    # anything else (Five)
    *)
        a=Four
        3=three
    ;;
esac
# now print:
<<Q
$a $b $c $d
$e
$f
$@
```
```
]