#include <iostream>
using namespace std;
void permmutation(char* p, const int a, const int b) {
if (a == b) {
for (int j = 0; j <= b; j++)
cout << p[j];
cout << endl;
}
else
{
for (int i = a; i <= b; i++) {
swap(p[a], p[i]);
permmutation(p, a + 1, b);
swap(p[a], p[i]);
}
}
}
int main()
{
char s[] = "abcde";
permmutation(s, 0, 4);
system("pause");
return 0;
}