title: Counting frequency of three letter words
body: <p>I'm trying to print out the number of three letter words in a string. The code below outputs the number of 0-3 letter words in a string. </p>
  
  <pre><code>import java.util.Scanner;
  
  public class Test {
  
  public static void main(String[] args) {
      // TODO Auto-generated method stub
  
      Scanner input = new Scanner(System.in);
  
      System.out.println("Input a string:"); 
         String s;
            s = input.nextLine();
  
       String[] strings = s.split(" ");
       int[] counts = new int[4];
       for(String str : strings)
            if(str.length() &lt; counts.length) counts[str.length()] += 1;
       for(int i = 1; i &lt; counts.length; i++)
           System.out.println(i + " letter words: " + counts[i]); 
  
       input.close();
  
      // TODO Auto-generated method stub
  
     }//end main
  
  }//end class
  </code></pre>
  
  <p>How would I modify this code to only show the number of three letter words? Any thoughts? </p>