public int minDistance(String word1, String word2){
		int rowSize = word1.length();
		int colSize = word2.length();
		if(rowSize == 0){
			return colSize;
		}
		if(colSize == 0){
			return rowSize;
		}
		int res[][] = new int[rowSize+1][colSize+1];
		for(int i=0; i<=rowSize; i++){
			res[i][0] = i;
		}
		for(int j=0; j<=colSize; j++){
			res[0][j] = j;
		}
		for(int i=1; i<=rowSize; i++){
			for(int j=1; j<=colSize; j++){
				if(word1.charAt(i-1) == word2.charAt(j-1)){
					res[i][j] = res[i-1][j-1];
				}
				else{
					int addLetterToWord1 = res[i][j-1] + 1;
					int deleteFromWord1 = res[i-1][j] + 1;
					int replaceLetterInWord1 = res[i-1][j-1] + 1;
					int temp = addLetterToWord1 < deleteFromWord1 ? addLetterToWord1 : deleteFromWord1;					
					res[i][j] = temp < replaceLetterInWord1 ? temp : replaceLetterInWord1;
				}
			}
		}
		return res[rowSize][colSize];
	}