This commit is contained in:
Ingy döt Net 2013-06-05 21:47:54 +00:00
parent 1f1ad49427
commit 6f050a029e
2496 changed files with 37609 additions and 3031 deletions

View file

@ -1,10 +1,14 @@
import fileinput
# return len(a) - len(b) if positive, 0 otherwise
# originally, return len(a) - len(b) if positive, 0 otherwise.
# Observing that longer is used for its Boolean result,
# and that '' is False, while any other string is True,
# longer need only to return a after removing len(b) characters,
# which is done without resorting to len().
def longer(a, b):
while len(a) and len(b):
while a and b:
a, b = a[1:], b[1:]
return len(a)
return a
longest, lines = '', ''
for x in fileinput.input():