forEach instead of for in
Count gap from start of subject to first match

This will emphasise matches where the subject starts with the same text
as the query.