← back to unit
Medium
# sorting medium
Secret Twins?
Two words are secret twins if one is just the other with its letters shuffled. 👯
You get two words a and b. Print twins if they're made of exactly the same letters, otherwise not twins. Sorting makes this almost unfair...
Example:
Input: a = "listen", b = "silent"
Output: twins
Sorting both words' letters gives the same result (eilnst), so they're made of exactly the same letters.
💡 need a hint?
sort-secret-twins.py🔒 given lines are locked — write your code in between
loading...