Salesforce Interview Question

Puzzle, Programming question on Strings