title: java - Find subsets of letters in a word
body: <p>I am trying to find anagrams of subsets of letters in a word; for example, if the word is "hello", the program will check the whole word, then the word with 1 letter missing and so on.</p>
  
  <p>Here is my code, I'm not sure where I am doing wrong:</p>
  
  <pre><code>import java.util.*;
  import java.io.*;
  class Perm {
      public static void main(String[] args) {
  
          System.out.println(permutations("hello")); 
      }
  
      public static String permutations(String word) {
          String s = "";
          for(int i=0; i&lt;word.length(); i++) {
              char ithChar = word.charAt(i);
              String newWord = word.substring(0,i) + word.substring(i+1);
              s = permutations(newWord);
          }
          return s;
  
      }
  }
  </code></pre>