/*
Nome: Mario
Cognome: Montanari

strpad usando C++.
*/

#include <iostream>
#include <cstring>

#define SIZE 100+1

using namespace std;

char *strpad(char *const str, unsigned start, unsigned end, char pad);

int main(void) {
	char str[SIZE] = "Buonasera";
	
	cout << str << endl;
	cout << strpad(str, 4, 3, '*') << endl;
	
	return 0;
}

char *strpad(char *const str, unsigned start, unsigned end, char pad) {
	memmove(str + start, str, strlen(str) + 1);
	memset(str, pad, start);
	
	str[strlen(str) + end] = '\0';
	
	memset(str + strlen(str), pad, end);
	
	return str;
}