// Permutations of characters(works for duplicate chars also)
//next_perm,,,, gives lexicographically next permutation
int dup_permute(char *str, size_t length) {
int count = 0;
std::sort(str, str+length);
do {
++count;
cout << str << '\n';
}
while(std::next_permutation(str, str+length));
return count;
}