title: profanity filter proogram - java
body: <p>I need to write a program that reads a string from the user and tests whether it contains profane words. For the sake of simplicity, we can assume that only these four words are considered profane: cat, dog, cow, and bear. It should consider any form of these words as profane e.g. cAt, CAT, CaT, etc. The program should only reject strings containing profane words as a whole. The program should then either print “sentence is fine” if it doesn’t contain any profane words or print a message reading “Sorry to reject your sentence as it contains profane words: “. For some reason when I run the code with only one word in the <code>String bad</code> everything works but when I add more than one word the program always prints “sentence is fine”  can anybody help me with this assignment, I am a new computer science student and clueless as what to do next.</p>
  <pre><code>import java.util.Scanner;
  
  import javax.lang.model.util.ElementScanner6;
  
  public class Prob3{
      public static void main(String[] args) 
  {
          
  Scanner input = new Scanner(System.in); 
  String bad = &quot;Cat&quot; + &quot;dog&quot; + &quot;Cat&quot; +&quot;cAt&quot; + &quot;caT&quot; + &quot;CAt&quot; + &quot;cAT&quot; + &quot;CaT&quot; + &quot;CAT&quot; + &quot;dog&quot; + &quot;Dog&quot; + &quot;dOg&quot; + &quot;doG&quot; + &quot;DOg&quot; + &quot;dOG&quot; + &quot;DoG&quot; + &quot;DOG&quot; + &quot;cow&quot; + &quot;Cow&quot; +&quot;cOw&quot; + &quot;coW&quot; + &quot;COw&quot; + &quot;cOW&quot; + &quot;CoW&quot; + &quot;COW&quot; + &quot;bear&quot; + &quot;Bear&quot; + &quot;bEar&quot; + &quot;beAr&quot; + &quot;beaR&quot; + &quot;BEAR&quot; + &quot;BEar&quot; + &quot;beAR&quot; + &quot;bEAr&quot; + &quot;BeaR&quot; + &quot;BeAr&quot; + &quot;bEaR&quot;;
  System.out.print(&quot;Please enter a string : &quot; );
  String s = input.next();
  if (s.contains(bad)){
  System.out.println(&quot;Sorry to reject your sentence as it contained the following profane words: &quot; + bad );
  }
  else {
  System.out.println(&quot;Sentence is fine&quot;);
  }
  
      
      
  
  }
  } ```
  
  
  </code></pre>