Strings with the same shape
Two strings s and t of the same length have the same shape when you can turn s into t by renaming its characters: every copy of a character becomes the same new character, and two different characters never become the same one. A character may keep its own name. Return True if s and t have the same shape, otherwise False.
Any character counts, spaces and digits included. Aim for one pass.
Besides the tests, one large input (two 5,000-character strings) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
same_shape("egg", "add")→truesame_shape("foo", "bar")→falsesame_shape("ab", "cc")→false