Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Translation solution in Clear category for Surjection Strings by igharok
def isometric_strings(a: str, b: str) -> bool:
return a.translate(str.maketrans(a, b)) == b
print("Example:")
print(isometric_strings("add", "egg"))
print(isometric_strings("foo", "bar"))
print(isometric_strings("bar", "foo"))
# These "asserts" are used for self-checking
assert isometric_strings("add", "egg") == True
assert isometric_strings("foo", "bar") == False
assert isometric_strings("bar", "foo") == True
assert isometric_strings("", "") == True
assert isometric_strings("all", "all") == True
assert isometric_strings("gogopy", "doodle") == False
assert isometric_strings("abba", "cccc") == True
print("The mission is done! Click 'Check Solution' to earn rewards!")
Sept. 26, 2024
Comments: