Distance between pattern and strings

Sign in to test your solution.