title: Java: Finding jumbled word
body: <p>In my country there is Game Show called Slagalica where one of the tasks is to find longest word in array of 12 letters. Size of the longest word is always 10, 11 or 12.  </p>
  
  <p>I have file with words from my language I use as database. Words that have 10, 11 or 12 letters in them I've saved in List (listWordSize10_11_12).
  When I enter jumbled word [12 letters] in I want from my program to find what word is that originally. I know how to make it work when jumbled word is 12 letters word but I can't work it out when it's less. </p>
  
  <p>Example: 10 letter word is jumbled + 2 random letters.<br>
  Goal is  for that 10 letter word to be recognized and printed in original state.  </p>
  
  <p>Where is what I've done:</p>
  
  <pre><code>    // un-jumbling word
      System.out.println("Unesite rijec koja treba da se desifruje: ");
      String jumbledWord = tast.nextLine();
      char[] letter = jumbledWord.toCharArray();
      Arrays.sort(letter);
      String sorted_Mistery_Word = new String(letter);
  
  
      for (int i = 0; i &lt; listWordSize10_11_12.size(); i++) {   
          int exception = 0;
          char[] letter_2 = listWordSize10_11_12.get(i).toCharArray();
          Arrays.sort(letter_2);
          String longWords = new String(letter_2);
          int j = i;
          while(longWords.length()&gt;i){
          if(sorted_Mistery_Word.charAt(j)!=longWords.charAt(i)){
                exception++;
                j++;
          }
          }
          if(exception &lt; 3){
              System.out.println("Your word is: "+listWordSize10_11_12.get(i));
              break;                
          }
      }
  </code></pre>
  
  <p>Thanks!!!
  P.S. This is not a homework or some job, just project I've been doing for fun!</p>
  
  <p>Thanks everyone for the help, I've learned a lot!</p>