build a string hackerrank solution