Driver code
public static void Main ( String [ ] args ) { char [ ] X = " abble " . ToCharArray ( ) ; char [ ] Y = " pie " . ToCharArray ( ) ; int n = X . Length ; int m = Y . Length ; int k = 2 ; int [ , , ] dp = new int [ N , N , N ] ; for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) { for ( int l = 0 ; l < N ; l ++ ) { dp [ i , j , l ] = - 1 ; } } } int ans = solve ( X , Y , n - 1 , m - 1 , k , dp ) ; Console . WriteLine ( ans == 1e9 ? - 1 : ans ) ; } }