1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lbvjy [14]
3 years ago
14

Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: If userInput is "That darn c

at.", then output is:
Censored


Ex: If userInput is "Dang, that was scary!", 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.


#include


#include


using namespace std;


int main() {


string userInput;


getline(cin, userInput);


int isPresent = userInput.find("darn");


if (isPresent > 0){


cout << "Censored" << endl; /* Your solution goes here */


return 0;


}
Computers and Technology
1 answer:
Alisiya [41]3 years ago
8 0

Answer:

The Java code is given below

Explanation:

import java.util.*;

public class CensoredWords {

public static void main(String args[]) {

Scanner scnr=new Scanner(System.in);

String userInput;

System.out.println("Enter String: ");

userInput=scnr.nextLine();

int res=userInput.indexOf("darn");

if(res == - 1) {

System.out.println(userInput);

} else {

System.out.println("Censored");

}

}

}

You might be interested in
Why is weather forecast so important for hang gliders?
professor190 [17]
Well, it wouldn't be such a good idea if they got caught up in a storm, would it? :p

Strong winds could blow them off-course, or even lightning has a chance of striking the hand glider, causing damage to the glider, the person, or even both.

Additionally, a weather forecast can help in my generic situations. For example, knowing whether to wrap up warm for cold weather, or wear something a bit more loose and breathable for hot weather.
6 0
4 years ago
To locate all locations in a document with the word "employer" and replace it with "company," you should use the _____ function.
grandymaker [24]
That should be the replace function which performs word replacements in documents.
6 0
3 years ago
What is a killer app??
mars1129 [50]
Application of a new technology and is much superior to rival products
6 0
3 years ago
Which term is defined by the total operating current of a circuit?
Mamont248 [21]

Answer:

OK PERO NOSE LM SOTTY BROTHER

Explanation:

6 0
3 years ago
In preparing a works cited list, you should
sergeinik [125]
In preparing a works cited list, you should mlways follow MLA style. MLA style is the proper way to cite references<span> </span>
7 0
3 years ago
Other questions:
  • What is the last step in conducting url search
    11·1 answer
  • Tanya has received an email, apparently from her bank, stating that some of her records were lost during server maintenance work
    14·1 answer
  • Fortnite anyone? i just started tdy so dont be judgiee lol
    6·2 answers
  • I have all the points to level up to virtuoso, but it hasn't yet does anyone know when it will?
    9·1 answer
  • How is counting in this circle and square system similar to how we count in our regular lives? How is it different?
    15·1 answer
  • Describe Relational Query Languages and Operations.
    15·1 answer
  • Which three techniques are used in this photo
    12·1 answer
  • Project light with a system of lenses used for projecting slides or film into a screen.
    5·1 answer
  • Questic
    8·1 answer
  • The users, groups, and roles that have access to a server are called ______________________________.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!