title: String frequency search not finding all words
body: <p>I am trying to implement a string frequency search algorithm that parses a <code>jokes.txt</code> file and gets the number of occurences of each unique word in the test. 
  The algorithm should consider case sensitivity and make "a" and "A" both unique. As of now, the algorithm seems to skip the first occurence of "a" in the test and many other words later on.</p>
  
  <p>Furthermore, the <code>words</code> array contains every word in the text. Somehow, the loop within the <code>(!isDuplicate)</code> condition skips over the "a" and doesn't increase the <code>count</code>.</p>
  
  <p><strong>jokes.txt</strong></p>
  
  <pre><code>I wondered why the baseball was getting bigger.
  Then it hit me.
  
  Police were called to a day care
  where a 3-yr-old was resisting a rest.
  ...
  </code></pre>
  
  <p><strong>WordCounter.java</strong></p>
  
  <pre><code>import java.util.*;
  import java.io.FileNotFoundException;
  import java.io.FileInputStream;
  
  public class WordCounter {
      ArrayList&lt;String&gt; words = new ArrayList&lt;String&gt;();
  
      //prints number of words in the  file
      public void numOfWords(Scanner key1) {
          int counter = 1;
          while(key1.hasNext()) {
              words.add(key1.next().replaceAll("[^a-zA-Z]", ""));
  
          }
      }
  
      //Takes word as parameter and returns frequency of that word
      public void frequencyCounter(Scanner key1) {
          ArrayList &lt;String&gt; freqWords = new ArrayList&lt;String&gt;();
          int count = 1;
          int counter = 1;
  
          for(int i = 0; i &lt; words.size(); i++){
              boolean isDuplicate = false;
              for (String s: freqWords){
                  if (s.contains(words.get(i).trim()))
                      isDuplicate =true;
              }
  
              if (!isDuplicate){
  
                  for(int j = i + 1; j &lt; words.size(); j++){
                      if(words.get(i).equals(words.get(j))){
                          count++;
                      }
                  }
                  freqWords.add(count + "-" + words.get(i));
                  Collections.sort(freqWords, Collections.reverseOrder());
                  count = 1;     
              }
          }
  
          for(int i = 0; i &lt; freqWords.size(); i++) {
              System.out.print((i+1) + "       ");
              System.out.println(freqWords.get(i));
          }
      }
  
  }
  </code></pre>