public static int minDistance(String word1, String word2) {
		// write your code here
		if (word1 == null || word2 == null) {
			return 0;
		}
		int aLen = word1.length();
		int bLen = word2.length();
		int[][] f = new int[aLen + 1][bLen + 1];
		
		for (int i = 0; i <= aLen; i++) {
			f[i][0] = i;
		}
		for (int j = 0; j <= bLen; j++) {
			f[0][j] = j;
		}
		
		for (int i = 1; i <= aLen; i++) {
			for (int j = 1; j <= bLen; j++) {
				if (word1.charAt(i-1) == word2.charAt(j-1)) {
					f[i][j] = f[i-1][j-1];
				} else {
					f[i][j] = Math.min(Math.min(f[i-1][j], f[i][j-1]), f[i-1][j-1]) + 1;
				}
			}
		}
		for (int i = 0; i < f.length; i++) {
			for (int j = 0; j < f[0].length; j++) {
				System.out.print(f[i][j]+ " ");
			}
			System.out.println();
		}
		return f[aLen][bLen];
	}