 <p>In the case where you are ignoring the first character, you only want to compare <code>word.length() - 1</code> characters -- and the same length for both the string and the word.</p> <p>Note that you really don't need to test the case where the first letter exactly matches as that is a subset of the case where you are ignoring the first letter.</p>