Single character drift
Your task
A configuration auditor renders the same service setting on two hosts and compares the two lines it gets back. Operators want to know whether one mistyped character explains the drift, which is cheap to fix, or whether the hosts are genuinely running different settings. Given baseline and rendered, return the zero based index of the single position where the two lines hold different characters, but only when the lines are the same length and disagree at exactly one position. Return -1 in every other case. Identical lines count as zero differences, so they are not a single character drift. Two or more disagreements are not one either. Lines of different lengths are never comparable this way. The comparison is case sensitive.
Examples
single_char_drift_index(baseline: str, rendered: str) -> intExample 1
Input
single_char_drift_index("timeout=30", "timeout=90")Output
8Example 2
Input
single_char_drift_index("retries=3", "retries=3")Output
-1Example 3
Input
single_char_drift_index("region=us-east-1", "region=us-west-1")Output
-1