Microsoft interview question

string traversal and data structure