Ormuco interview question

string operation problem