Driver code
int main ( ) { string str = "4321" ; if ( prevPermutation ( str ) ) cout << " Previous ▁ permutation ▁ is ▁ " << str ; else cout << " Previous ▁ permutation ▁ doesn ' t ▁ exist " ; return 0 ; }