@@ -0,0 +1,1611 @@
+import java.util.*;%0Aclass abc%0A%7B%0A    static int wordladder(String start,String target,ArrayList%3CString%3E al)%0A    %7B%0A        HashSet%3CString%3E hs=new HashSet%3C%3E(al);%0A        if(!hs.contains(target)) return 0;%0A        Queue%3CString%3E q=new LinkedList%3C%3E();%0A        q.add(start);%0A        int level=1;%0A        while(!q.isEmpty())%0A        %7B%0A            int count=q.size();%0A            for(int i=0;i%3Ccount;i++)%0A            %7B%0A                String curr=q.poll();%0A                char a%5B%5D=curr.toCharArray();%0A                for(int j=0;j%3Ca.length;j++)%0A                %7B%0A                    char original_char=a%5Bj%5D;%0A                    for(char c='a';c%3C='z';c++)%0A                    %7B%0A                        if(a%5Bj%5D==c) continue;%0A                        a%5Bj%5D=c;%0A                        String new_string=new String(a);%0A                        if(new_string.equals(target)) return level+1;%0A                        if(hs.contains(new_string))%0A                        %7B%0A                            q.add(new_string);%0A                            hs.remove(new_string);%0A                        %7D%0A                    %7D%0A                    a%5Bj%5D=original_char;%0A                %7D%0A            %7D%0A            level++;%0A        %7D%0A        return 0;%0A    %7D%0A    public static void main(String%5B%5D args) %7B%0A        String start,target;%0A        Scanner sc=new Scanner(System.in);%0A        start=sc.next();%0A        target=sc.next();%0A        int n=sc.nextInt();%0A        ArrayList%3CString%3E al=new ArrayList%3C%3E();%0A        for(int i=0;i%3Cn;i++)%0A        al.add(sc.next());%0A        System.out.println(wordladder(start, target, al));%0A        sc.close();%0A    %7D%0A%7D

solve word-latter problem