Back
Close
  • 137

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

Statement

 Goal

In a lot of clash of code problems, you need to replace text from one form to the other. To figure it out quickly, you have decided to write a program to look at two lines and extract the replacement sequences (if any) that will convert text X into text Y.

The replacement sequences are always applied based on the characters of the original text X. For example, if a character FROM1 is replaced with TO1, it cannot be replaced again by a later rule that replaces TO1 with TO2.

Hurry!
Input
Line 1: Text X.
Line 2: Text Y, with the same length as text X.
Output
If not possible: One line: CAN'T
If X and Y are equal: One line: NONE
Otherwise, each line (in the order they appear in X): FROM -> TO
Constraints
0 < Length of X, Y < 100
Example
Input
BARTENDER
CARBENDER
Output
B->C
T->B

A higher resolution is required to access the IDE