Posting this with solution provided.
The use case could be framed in a number of ways:
- Return all characters that match at the start of two strings, until they do not match
- How many characters match between two strings before one character doesn't match?
- What is the first character that doesn't match between two strings?
If I have the strings
'Interested' they are similar for all the characters
'Interest' and then the first string ends in '
ing' while the second ends in '
ed'. Therefore, they have 8 characters in common, the first non-matching character is the 9th and the identical string is
For the question in the title, the first non-matching character is number 9.