Driver code
public static void Main ( String [ ] args ) { char [ ] str = "4321" . ToCharArray ( ) ; if ( prevPermutation ( str ) ) { Console . WriteLine ( " Previous ▁ permutation ▁ is ▁ " + String . Join ( " " , str ) ) ; } else { Console . WriteLine ( " Previous ▁ permutation " + " doesn ' t ▁ exist " ) ; } } }