#include <bits/stdc++.h>
using
namespace
std;
void
find_missing_strings(string Permutation_given[],
size_t
Size_Permutation_given)
{
vector<string> permutations;
string input = Permutation_given[0];
permutations.push_back(input);
while
(
true
) {
string p = permutations.back();
next_permutation(p.begin(), p.end());
if
(p == permutations.front())
break
;
permutations.push_back(p);
}
vector<string> missing;
set<string> given_permutations(
Permutation_given,
Permutation_given + Size_Permutation_given);
set_difference(permutations.begin(), permutations.end(),
given_permutations.begin(),
given_permutations.end(),
back_inserter(missing));
for
(
auto
i = missing.begin(); i != missing.end(); ++i)
cout << *i << endl;
}
int
main()
{
string Permutation_given[]
= {
"ABCD"
,
"CABD"
,
"ACDB"
,
"DACB"
,
"BCDA"
,
"ACBD"
,
"ADCB"
,
"CDAB"
,
"DABC"
,
"BCAD"
,
"CADB"
,
"CDBA"
,
"CBAD"
,
"ABDC"
,
"ADBC"
,
"BDCA"
,
"DCBA"
,
"BACD"
,
"BADC"
,
"BDAC"
,
"CBDA"
,
"DCAB"
};
size_t
Size_Permutation_given
=
sizeof
(Permutation_given)
/
sizeof
(*Permutation_given);
find_missing_strings(Permutation_given,
Size_Permutation_given);
return
0;
}