Strip quoted comments
Your task
Write the comment stripper for a dotfile format. In each line, a "#" begins a comment that runs to the end of the line, UNLESS the "#" sits inside a double-quoted region. Scanning left to right, each '"' toggles quoted mode (there are no escape characters, and a quote opened on a line may simply never close). After removing any comment, delete trailing spaces from what remains; keep leading whitespace untouched. Lines that end up empty disappear entirely. Return the surviving lines in their original order.
Examples
strip_inline_comments(lines: list[str]) -> list[str]Example 1
Input
strip_inline_comments(["name=\"a # b\" # real comment", "# full comment", "port=80"])Output
["name=\"a # b\"", "port=80"]