绕口令
* * * *
拉格朗日计划
* * * *
绕口令

打印以下三组绕口令,两组之间用一个空行隔开:

How much wood would a woodchuck chuck,
If a woodchuck could chuck wood?
A woodchuck would chuck all the wood he could chuck
If a woodchuck would chuck wood.
  
Peter Piper picked a peck of pickled peppers.
A peck of pickled peppers Peter Piper picked.
If Peter Piper picked a peck of pickled peppers,
Where's the peck of pickled peppers Peter Piper picked?
  
She sells seashells by the seashore,
The shells she sells are seashells, I'm sure.
So if she sells seashells on the seashore,
Then I'm sure she sells seashore shells.


本题难度:



解答

把重复出现的词用符号表示,用数组a记录符号和词的对应关系,替换后打印。

最终代码有四行。

代码长度:430字节 vs. 全站第一:268字节。

a="+-!-0-1-2-3-4-5-6-7-8-9-X-Y-\n-the-wood-chuck-ould-peck-peppers-Peter Piper picked-pickled-ells-sh-sea-I'm sure-ore".split("-")
s="How much 0 w2 a 01 1,+If a 01 c2 1 0?+A 01 w2 1 all ! 0 he c2 1+If a 01 w2 1 0.++5 a 3 of 6 4.+A 3 of 6 4 5.+If 5 a 3 of 6 4,+Where's ! 3 of 6 4 5?++She s7 987 by ! 98Y,+The 87 8e s7 are 987, X.+So if 8e s7 987 on ! 98Y,+Then X 8e s7 98Y 87."
for i in range(14):s=s.replace(a[i],a[i+14])
print(s)