Argusoft interview question

puzzle and one string based code