From every index in S2 , check the number of mis - matching characters in substring of length of S1
for ( int j = 0 ; j < n ; j ++ ) { if ( S1 . charAt ( j ) != S2 . charAt ( i + j ) ) { minRemovedChar ++ ; } }