Driver code
public static void main ( String [ ] args ) { char s [ ] = { ' b ' , ' a ' , ' n ' , ' a ' , ' n ' , ' a ' } ; int n = s . length ; int k = 2 ; char t [ ] = new char [ n ] ; subsequence ( s , t , n - 1 , k ) ; for ( int i = 0 ; i < t . length ; i ++ ) if ( t [ i ] != 0 ) System . out . print ( t [ i ] ) ; } }