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
If you are looking for someone to do my java homework then we can help with your assignment.
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(System.in);
String userInput;
userInput = scnr.nextLine();
if(userInput.contains("darn")){
System.out.println("Censored");
}else{
System.out.println(userInput);
}
}
}