www.hackerrank.com/contests/w3/challenges/sam-and-substrings