End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
rightmin to track the minimum character in the suffix starting from each index in s.t and an empty string p for the output.s from left to right.t and append them to p if they are lexicographically smaller or equal to both the current character in s and the minimum character in the suffix of s.s to t.t and append them to p.p.