Solve a simpler case first
Some inputs arrive messy: long, irregular, full of detail you did not ask for. Trying to handle all of it at once is how a function grows knotted and wrong.
Take this task: pull the fields out of a CSV line. Real lines carry quoting, so this one hides a comma inside the first field:
"Ada, Lovelace",36,London
Parse that in one pass and you will get tangled. Do not start with the mess. Start with a cleaner version of the same input:
Ada,36,London→["Ada", "36", "London"]
For that line the rule is a single sentence: split on every comma. You can write it, run it, and see it work. The clean case is solved.
Now add the mess back, one fact at a time. A quote can wrap a field, so a comma inside quotes is not a separator. Fields can carry spaces around them, so trim each one. Each new fact is a small change to a function that already works, and you can check it against a real line as you go.
That is the move: shrink the input until the rule is obvious, solve that, then widen the input and patch the rule. You never face the whole mess cold.
You are about to answer a short quiz on simplifying the input.