def slice(text, from, to)
{
	bit = "";
	i = from;
	while(i < to)
	{
		bit = bit + text[i];
		i = i + 1;
	}
	return bit;
}

def replace(text, replacement, start_position, end_position)
{
	prefix = slice(text, 0, start_position);
	suffix = slice(text, end_position, len(text));
	result = prefix + replacement + suffix;
	return result;
}