Seat hold expiry

Write codeEasy18 minAirbnb style

Your task

A box office parks a seat for a buyer while checkout runs. events replays what happened, one entry per line written "second|action|seat|customer", given in nondecreasing order of second. action is either hold or confirm, and seat and customer names carry no bar and no equals sign. A hold placed at second t belongs to that customer from t through t plus hold_seconds minus 1 and is gone at t plus hold_seconds. A hold is granted only when the seat is unsold and carries no live hold, so a buyer asking again for a seat they already hold is refused and the original expiry stands. A confirm works only when that same customer's hold is still live at that second, and it sells the seat for good, so every later event touching that seat does nothing. Return one "seat=customer" entry per sold seat, sorted by seat name as ordinary text.

Examples

settle_seat_holds(events: list[str], hold_seconds: int) -> list[str]
Example 1
Inputsettle_seat_holds(["10|hold|A1|nina", "10|hold|A2|omar", "12|confirm|A1|nina", "40|confirm|A2|omar"], 30)
Output["A1=nina"]
Example 2
Inputsettle_seat_holds(["0|hold|B3|pia", "0|hold|B3|quinn", "5|confirm|B3|quinn", "9|confirm|B3|pia"], 10)
Output["B3=pia"]