Microsoft interview question

Complex string manipulation without api.