Write a Python function parse_duration(text: str) -> int tha...
Prompt
Write a Python function parse_duration(text: str) -> int that converts a duration string into a number of seconds. Rules: - A duration is one or more parts. Each part is a whole number (digits only: no sign, no decimal point) immediately followed by one unit letter: d = 86400, h = 3600, m = 60, s = 1. - Unit letters are lowercase only. - Parts may be separated by spaces and may appear in any order, but each unit may appear at most once. - Leading and trailing spaces are ignored. - Anything else, including an empty string, raises ValueError. Reply with exactly two sections and nothing else: 1. One Python code block containing the function. Standard library only, at most 30 lines. 2. A Markdown table with columns "Input" and "Result", one row for each input below, in this order. Result is the returned integer, or ValueError. Inputs: "1h30m" " 2h 5s " "45s" "1d2h" "30m1h" "0s" "1h1h" "" "5" "1.5h" "2H" "1h 30"