Answer:
The program goes as follows
Comments are used to explain difficult lines
#include <iostream>
#include <string>
using namespace std;
int main()
{
string userinput;
getline(cin,userinput);
/* My Solution starts here*/
//Initialize sub string position to 0
int stringpos = 0;
// Declare an iterating variable to iterate through userinput
int startpos;
//Declare and initialize a determinant variable
int k = 0;
while((startpos = userinput.find("darn",stringpos))!=string::npos)
{
//If userinput contaings "darn", increase k by 1
k++;
// Go to next string position
stringpos = startpos+1;
}
//If determinant variable k is p then, userinput does not contain "darn"
if(k==0)
{
cout<<userinput;
}
//Otherwise, it contains "darn"
else
{
cout<<"Censored";
}
/* My Solution ends here*/
return 0;
}
See attached for .cpp program file