Pen and paper are programmers best friends (as already suggested by deanhystad) :-). Solution could be easily visualized and become obvious:
There are built-in functions in Python to iterate pairwise and to get indices while doing it.
Output:
are
equal
╭──┴──╮
c | r | a | t | e |
↘ ↘ ↘
c | r | e | a | t | e |
╰─┬─╯
first
non equal
'Encountering first unequal character pair all characters in shorter string must equal to next character in longer string'There are built-in functions in Python to iterate pairwise and to get indices while doing it.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.