how to solve sam and substrings

join shbcf.ru