Let $S$ and $T$ two stopping time w.r.t. the filtration $(\mathcal F_t)_t$ such that there is $M>0$ s.t. $$S\leq T\leq M\quad a.s.$$ Show that if $B\in \mathcal F_S$, we have that $$\sigma =T\boldsymbol 1_B+M\boldsymbol 1_{B^c},$$ is a stopping time where $$\mathcal F_S=\{A\in \mathcal F_\infty\mid A\cap \{T\leq t\}\in \mathcal F_t,\forall t\geq 0 \}.$$
Try
I try to show that $\{\sigma \leq t\}^c\in \mathcal F_t$. $$\{\sigma >t\}=\{T\boldsymbol 1_B+M\boldsymbol 1_{B^c}>t\}=\bigcup_{r\geq t, r\in \mathbb Q^+}\{T\boldsymbol 1_B>r\}\cap \{M\boldsymbol 1_{B^c}>t-r\}.$$
How can I continue ? I guess that $$\{T\boldsymbol 1_B>r\}=B\cap \{T>r\}\quad \text{and}\quad \{M\boldsymbol 1_{B^c}>t-r\}$$ and thus $$\{T\boldsymbol 1_B>r\}\cap \{M\boldsymbol 1_{B^c}>t-r\}=(B\cap B^c)\cap \{T>r\}\cap \{M>t-r\}=\emptyset,$$ so probably something is wrong...
Note that when $r>t$ we get $\{MI_{B^{c}}>t-r\}=\Omega$ because $MI_{B^{c}} \geq 0 >t-r$. BTW you also have to include $r=t$ in the union. The union is $B \cap (T>t)$.