Python Forum
Find Mismatch Between Two Strings
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find Mismatch Between Two Strings
#9
Pen and paper are programmers best friends (as already suggested by deanhystad) :-). Solution could be easily visualized and become obvious:


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.
Reply


Messages In This Thread
Find Mismatch Between Two Strings - by Omid - Oct-16-2020, 07:06 PM
RE: Find Mismatch Between Two Strings - by DPaul - Oct-17-2020, 07:02 AM
RE: Find Mismatch Between Two Strings - by Omid - Oct-19-2020, 01:46 PM
RE: Find Mismatch Between Two Strings - by perfringo - Oct-19-2020, 02:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Strings inside other strings - substrings OmarSinno 2 3,698 Oct-06-2017, 09:58 AM
Last Post: gruntfutuk

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020