首页 > 代码库 > POJ - 1731 Orders

POJ - 1731 Orders

题意:排序后字符串全排列

思路:好久没水一题了

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 220;

char str[MAXN];

int main() {
	while (scanf("%s", str) != EOF) {
		int n = strlen(str);
		sort(str, str+n);
		printf("%s\n", str);
		while (next_permutation(str, str+n)) 
			printf("%s\n", str);
	}
	return 0;
}