Skip to content

Instantly share code, notes, and snippets.

@PeterHajdu
Created July 29, 2012 13:59
Show Gist options
  • Save PeterHajdu/3199037 to your computer and use it in GitHub Desktop.
Save PeterHajdu/3199037 to your computer and use it in GitHub Desktop.
anagram generation
#include <iostream>
#include <algorithm>
#include <string>
int main()
{
std::string word( "dog" );
std::sort( word.begin(), word.end() );
do {
std::cout << word << std::endl;
} while ( std::next_permutation( word.begin(), word.end()) );
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment