std::string str = "sal"; std::sort(str.begin(), str.end()); do { std::cout << str << "\t"; } while (std::next_permutation(str.begin(), str.end()));