First log line with keyword

Write codeEasy11 min

Your task

An API gateway logs lines shaped like "<timestamp> <LEVEL> <message>", where the timestamp is a sortable string such as "2026-07-01T10:00:03". Given the lines in the order they were written and a keyword, return the timestamp of the first line whose message part, everything after the level token, contains the keyword as a substring. Return "" if no message matches. The timestamp and level tokens are not part of the message.

Examples

first_match_timestamp(lines: list[str], keyword: str) -> str
Example 1
Inputfirst_match_timestamp(["2026-07-01T10:00:00 INFO cache warm start", "2026-07-01T10:00:03 ERROR payment timeout", "2026-07-01T10:00:07 ERROR payment timeout"], "timeout")
Output"2026-07-01T10:00:03"