public static int calcDiff(String word1, String word2){
        int diff = 0;
        int j=0;
        for(int i=0; i<word1.length(); i++){
            char ch1 = word1.charAt( i );
            if(word2.length()<=j){
                diff++;
                continue;
            }
            char ch2 = word2.charAt( j++ );
            if(ch1 == ch2){
                continue;
            }
            diff++;
            if(word2.length() > j && word2.charAt( j ) == ch1){
                j++;
                continue;
            }
            if(word1.length() > (i+1) && word1.charAt( i+1 ) == ch2){
                i++;
                continue;
            }
        }
        diff += word2.length()-j;
        return diff;
    }