Added string permuation algorithm