public static int findTransform(String s , String e, ArrayList<String> dict){
        LinkedList<String> q = new LinkedList<>();
        dict.add(e);
        if (s==null || e==null || s.length() ==0 || e.length()==0 || s.length()!=e.length())
            return -1;
        q.add(s);

        int dist = 0;
        while(!q.isEmpty()){
            String cur = q.pop();
            if (cur.equals(e))
                return dist;
            else{
                q.addAll(findOneWordShifts(cur, dict));
            }
        }
        return -1;
    }