Phase 1: Extract character ordering from adjacent word pairs

Reading Between the Lines

You are given a list of words sorted in an alien language's dictionary order. You do not know the alphabet, but you know the words are lexicographically sorted. From that sorting, you must reverse-engineer the ordering rules — which letters come before which.

The key insight: in any sorted dictionary, comparing adjacent words reveals one character ordering constraint. If two adjacent words match in their first k characters, the (k+1)th character of the first word comes BEFORE the (k+1)th character of the second word in the alien alphabet. That is the only constraint derivable from that pair — and it is exactly one constraint.

words = [“wrt”,“wrf”,“er”,“ett”,“rftt”]. Four adjacent pairs, each giving at most one ordering rule. Tap through each pair to extract the constraint.

Comparing 'wrt' and 'wrf': the first two characters match (w, r). What does the third character difference tell you?