Let $0=a_0 < a_1 < \dots < a_m = \infty$ be given real numbers and let $\lambda_1, \dots, \lambda_m$ be positive real numbers. Let $T_i$ have hazard
$$ h(t) = \lambda_j, \quad \text{if $t \in (a_{j-1}, a_j]$} $$
Let $(t_1, \delta_1), \dots, (t_n, \delta_n)$ be $n$ independent observations of failure times with the given hazard and indicators of right-censoring (that happens independently of the failure times). Estimate $\lambda_1, \dots, \lambda_m$ using maximum likelihood estimation.
My attempt at solution
Since the censoring is independent of the failure times, we have
$$ L(\lambda_1, \dots, \lambda_m) \propto \prod_{i=1}^n h(t_i)^{\delta_i} S(t_i) $$
where $S$ is the survival function corresponding to the hazard function, $h$. Defining $\Delta_j = a_j-a_{j-1}$ for $j=1, \dots, m$, we get that
$$ S(t) = \exp\left(-\lambda_j (t-a_{j-1}) - \sum_{i<j}\lambda_i \Delta_i \right), \quad \text{if $t \in (a_{j-1},a_j]$} $$
I'm not quite sure how to rewrite the likelihood function from here. Any help?