Union of intervals/Continuous function to R/Exercise

Let be real numbers and let

and

be continuous functions such that . Prove that the function

such that

is also continuous.