Problem Statement:

Print “censored” if userinput contains the word “darn”, else print userinput. end with newline.

Ex: If userinput is Dang, that was scaryl”, then output is: Dang, that was scary

Note: If the submitted code has an out-of-range access, the system will stop running the code after a few seconds, and report Program end never reached The system doesn’t print the test case that caused the reported message.

import java.util.Scanner;

public class CensoredWords {

   public static void main(String[] args) {
       Scanner scnr = new Scanner(;
       String userInput;

       userInput = scnr.nextLine();