title: How to check that a string contains characters other than those specified. (in Java)
body: <p>I have a program that asks the user to input a three character string. The string can only be a combination of a, b, or c. </p>
  
  <p>How do I check if the string contains any other characters than those specified without doing a million conditional statements.</p>
  
  <p>Pseudo example:</p>
  
  <pre><code>String s = "abq"
  
  if (s.containsOtherCharacterThan(a,b,c))
      System.exit(-1)
  </code></pre>