@@ -0,0 +1,627 @@
+import java.util.*;%0A%0Apublic class Problem9_5 %7B%0A%0A  public static void main(String%5B%5D args) %7B%0A    System.out.println(permutations(%22abcd%22));%0A  %7D%0A%0A  public static List%3CString%3E permutations(String s) %7B%0A    return permutations(%22%22, s);%0A  %7D%0A%0A  public static List%3CString%3E permutations(String prefix, String s) %7B%0A    List%3CString%3E ret = new ArrayList%3C%3E();%0A    if (s.isEmpty()) %7B%0A      ret.add(prefix);%0A      return ret;%0A    %7D%0A%0A    for (int i = 0; i %3C s.length(); i++) %7B%0A      char c = s.charAt(i);%0A      ret.addAll(%0A        permutations(prefix + c, s.substring(0, i) + s.substring(i + 1, s.length()))%0A      );%0A    %7D%0A    return ret;%0A  %7D%0A%0A%7D%0A

Problem 9_5