POJ1731-Orders
http://poj.org/problem?id=1731
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int main(void) { char str[202]; while(gets(str)) { int n=strlen(str); sort(str,str+n); printf("%s\n",str); while(next_permutation(str,str+n)) printf("%s\n",str); } return 0; }