Blueshift Interview Question

the question was about string permutation