Longest string challenge: Difference between revisions

Content deleted Content added
m →‎{{header|REXX}}: added/changed comments and whitespace, used a template for the output.
Line 1,677:
<lang python>import fileinput
 
# This returns True if the second string has a value on the
# originally, return len(a) - len(b) if positive, 0 otherwise.
# same index as the last index of the first string. It runs
# Observing that longer is used for its Boolean result,
# faster than trimming the strings because it runs len once
# and that '' is False, while any other string is True,
# and is a single index lookup versus slicing both strings
# longer need only to return a after removing len(b) characters,
# one character at a time.
# which is done without resorting to len().
def longer(a, b):
while a and btry:
a, b = [len(a[1:], b[)-1:]
return aFalse
except:
return True
 
longest, lines = '', ''