Amazon Interview Question

Weโ€™re given: source string encrypted string We need to check if: ๐Ÿ‘‰ The encryption mapping is valid From the example: "abcda" โ†’ "zyxvz" โ†’ valid "acbb" โ†’ "yzxk" โ†’ invalid So the rule seems: ๐Ÿ‘‰ Each character in source should map to exactly one character ๐Ÿ‘‰ Mapping must be consistent