given a single input string, write a function that produces all possible anagrams of a string and outputs them as an array youtube code example
Example 1: find all permutations of a string
void permute(string a, int l, int r)
{
// Base case
if (l == r)
cout<
Example 2: how to print all permutations of a string
void permutation(string s)
{
sort(s.begin(),s.end());
do{
cout << s << " ";
}
while(next_permutation(s.begin(),s.end()); // std::next_permutation
cout << endl;
}