Question
Guide a walker from the start cell to the exit of a character grid, where locked doors stay shut until the matching key has been picked up, and report the fewest single-cell moves needed. ```python def solve(raw: str) -> str: ... ``` ## Requirements - Line 1 gives `rows cols`. The next `rows` lines each contain exactly `cols` characters. - `.` is open floor, `#` blocks movement, `S` is the start, and `E` is the exit. - Lowercase letters `a` through `f` are keys. Uppercase `A` through `F` are doors that require the key with the same letter. - `E` marks the exit and is never read as the door for key `e`. - A collected key is kept permanently, so the walker may revisit a cell with a different set of keys. - Each move changes the row or column by one. Entering a door without its key is not allowed. - Return the minimum number of moves from `S` to `E` as a decimal string, or `"-1"` when the exit cannot be reached. - The grid contains exactly one `S` and one `E`. - `run_case(case: dict)` forwards `case["stdin"]` to `solve`. - Do not append a trailing newline to the returned string; return the value exactly once.