Driver code
public static void Main ( String [ ] args ) { char [ ] pat = " bca " . ToCharArray ( ) ; char [ ] str = " abc " . ToCharArray ( ) ; sortByPattern ( str , pat ) ; Console . WriteLine ( String . Join ( " " , str ) ) ; } }