Same shape lists

Write codeEasy12 min

Your task

Two integer lists have the same shape when equality between positions lines up exactly: for every pair of indices i and j, a[i] == a[j] holds precisely when b[i] == b[j]. Put differently, one list can be turned into the other by consistently renaming values, with distinct values staying distinct. Lists of different lengths never match. Return whether the two lists have the same shape. For example, [1, 2, 1] and [7, 9, 7] do; [1, 1] and [2, 3] do not; and [1, 2] versus [3, 3] also do not.

Examples

same_shape(a: list[int], b: list[int]) -> bool
Example 1
Inputsame_shape([1, 2, 1], [7, 9, 7])
OutputTrue