substring problem hackerrank