← Back to challenges

Letters Shared Between Two Words

PythonHardarraysstrings

Instructions

Create a function that returns the number of characters shared between two words.

Examples

shared_letters("apple", "meaty") ➞ 2
# Since "ea" is shared between "apple" and "meaty".

shared_letters("fan", "forsook") ➞ 1

shared_letters("spout", "shout") ➞ 4

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Check If Lines Are Parallel