Blueshift interview question

the question was about string permutation