Skip to content

Instantly share code, notes, and snippets.

@devteampentagon
Created January 26, 2017 04:27
Show Gist options
  • Save devteampentagon/dd769a0c7d0a69d109f3f80763c158cd to your computer and use it in GitHub Desktop.
Save devteampentagon/dd769a0c7d0a69d109f3f80763c158cd to your computer and use it in GitHub Desktop.
Permutations of a string
#include <bits/stdc++.h>
#define MEM(a,b) memset((a),(b),sizeof(a))
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MIN3(a,b,c) MIN(MIN(a,b),c)
#define MIN4(a,b,c,d) MIN(MIN(MIN(a,b),c),d)
#define In freopen("In.txt", "r", stdin);
#define Out freopen("out.txt", "w", stdout);
#define i64 long long
#define u64 long long unsigned
#define INF (1<<28)
using namespace std;
int main()
{
string str;
cin >> str;
do
{
cout << str << endl;
}while(next_permutation(str.begin(),str.end()));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment