#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<char> v;
unsigned i;
for(i=0; i<3; i++)
v.push_back('A'+i);
do {
for(i=0; i < v.size(); i++){
cout << v[i] << endl;
}
} while(next_permutation(v.begin(), v.end()));
prev_permutation(v.begin(), v.end());
do {
for(i=0; i<v.size(); i++){
cout << v[i] << endl;
}
} while(prev_permutation(v.begin(), v.end()));
return 0;
}
|