生成歌曲《I Know an Old Lady Who Swallowed a Fly》的歌词。
你当然可以复制粘贴歌词,或者从文件里读取,但如果用算法的方式来解决,这道题会有趣得多。
这是一首来源不明的累积歌曲。
这是众多常见版本之一。
I know an old lady who swallowed a fly.
I don't know why she swallowed the fly. Perhaps she'll die.
I know an old lady who swallowed a spider.
It wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.
I know an old lady who swallowed a bird.
How absurd to swallow a bird!
She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.
I know an old lady who swallowed a cat.
Imagine that, to swallow a cat!
She swallowed the cat to catch the bird.
She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.
I know an old lady who swallowed a dog.
What a hog, to swallow a dog!
She swallowed the dog to catch the cat.
She swallowed the cat to catch the bird.
She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.
I know an old lady who swallowed a goat.
Just opened her throat and swallowed a goat!
She swallowed the goat to catch the dog.
She swallowed the dog to catch the cat.
She swallowed the cat to catch the bird.
She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.
I know an old lady who swallowed a cow.
I don't know how she swallowed a cow!
She swallowed the cow to catch the goat.
She swallowed the goat to catch the dog.
She swallowed the dog to catch the cat.
She swallowed the cat to catch the bird.
She swallowed the bird to catch the spider that wriggled and jiggled and tickled inside her.
She swallowed the spider to catch the fly.
I don't know why she swallowed the fly. Perhaps she'll die.
I know an old lady who swallowed a horse.
She's dead, of course!
实现以下词:
food-chain ( start end -- lines )
start和end是段号(1 对应苍蝇,最大到 8 对应马),包含两端。以字符串序列的形式返回请求的段落,歌曲的每一行对应一个字符串。
当请求多个段落时,用单个空字符串("")分隔连续的段落,这样各段落之间会以空行呈现。最后一个段落之后没有末尾空行。
1 2 food-chain .
! => {
! "I know an old lady who swallowed a fly."
! "I don't know why she swallowed the fly. Perhaps she'll die."
! ""
! "I know an old lady who swallowed a spider."
! "It wriggled and jiggled and tickled inside her."
! "She swallowed the spider to catch the fly."
! "I don't know why she swallowed the fly. Perhaps she'll die."
! }