Types: str: str, q: int, commands: List[Union[str, Tuple[str, int, int], Tuple[str, int, int, str]]]
Ranges: 1 ≤ length of str ≤ 1000, 1 ≤ q ≤ 100, 0 ≤ a ≤ b < length of str
Addtl Info: for replace command, b - a + 1 = length of p