title: Java compare string with substring
body: <p>I was having some problem when trying to compare strings in Java. </p>
  
  <p>Example of list of words to be compared:</p>
  
  <pre><code>angry, berry, you, young, your, apple, orange, yeast
  </code></pre>
  
  <p>When user entered 'y' character, the results I am getting:</p>
  
  <pre><code>angry, berry, you, young, your, yeast
  </code></pre>
  
  <p>By right it supposed to return these only:</p>
  
  <pre><code>you, young, your, yeast
  </code></pre>
  
  <p>The next time when the user entered 'you', the 'yeast' should be filtered out.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>for (String v : words) {
          if (v.toLowerCase().contains(input.toLowerCase())){
              System.out.print("MATCHING WORDS " + v);
          }
      }
  </code></pre>
  
  <p>Any ideas? Thanks!</p>