/*
Nome: Mario
Cognome: Montanari

parolaCensurata
*/

#include <iostream>
#include <cstring>

#define SIZE 100+1

using namespace std;

char *parolaCensurata(char *const str, const char *substr);

int main(void) {
	char str[] = "fuck all the world!";
	const char substr[] = "fuck";
	
	cout << "Frase originale: " << str << endl;
	
	cout << "Frase censurata: " << parolaCensurata(str, substr);
	
	return 0;
}

char *parolaCensurata(char *const str, const char *substr) {
	int len = strlen(substr);
	
	for (char *pc = str; (pc = strstr(pc, substr)) != NULL; pc = pc + len) {
		memset(pc + 1, '*', len - 2);
	}
	
	return str;
}