class Spell{ private String w; public Spell(String s){ w = s; } int spell(String s, int i, int j) { if (j == w.length()) { return (s.length()-i); } else if (i == s.length()) { return (w.length()-j); } else if (s.charAt(i) == w.charAt(j)) { return(spell(s,i+1,j+1)); } else { int ins = spell(s,i,j+1) + 1; int del = spell(s,i+1,j) + 1; if (ins > del) { return(del); } else { return(ins); } } } public int spell(String s) { return spell(s,0,0); } }