Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Match c1 and c2 solution in Clear category for Surjection Strings by Ilis
def isometric_strings(str1: str, str2: str) -> bool:
if len(str1) != len(str2):
return False
match = {}
for c1, c2 in zip(str1, str2):
if c1 in match and match[c1] != c2:
return False
else:
match[c1] = c2
return True
if __name__ == '__main__':
print("Example:")
print(isometric_strings('add', 'egg'))
# These "asserts" are used for self-checking and not for an auto-testing
assert isometric_strings('add', 'egg') is True
assert isometric_strings('foo', 'bar') is False
assert isometric_strings('', '') is True
assert isometric_strings('all', 'all') is True
print("Coding complete? Click 'Check' to earn cool rewards!")
May 29, 2019
Comments: