Traversing map and finding duplicate elements .
for ( auto e : hm ) { int x = e . second ; if ( x > 1 ) { int temp5 = factorial ( x ) ; f /= temp5 ; } return f ; } } static void nextPermutation ( string & temp ) {