title: Check if a string contains only a set of letters
body: <p>I'm trying to check if a word contains only a set of letters such as I,O,S,H and X
  Suppose the user enters: SSHX, the output will be yes but if the user enters SHEXX, the output will be NO</p>
  
  <pre><code>public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
  
      String word = sc.next();
      word = word.toUpperCase();
  
      int length = word.length();
      char letter = 0;
  
      for (int counter = 0; counter &lt; length; counter++) {
          letter = word.charAt(counter);
      }
      if (letter != 'I' &amp;&amp; letter != 'O' &amp;&amp; letter != 'S' &amp;&amp; letter != 'H' &amp;&amp; letter != 'Z' &amp;&amp; letter != 'X' &amp;&amp; letter != 'N') {
          System.out.print("NO");
      } else {
          System.out.print("YES");
      }
  }
  </code></pre>