Simple Letters

Published by Werdna in

Create a function that takes two lowercase strings $s1 and $s2 of letters from a to z and returns the sorted and longest string containing distinct letters.

Examples

$s1 = "mubashir"
$s2 = "edabit"

longestString($s1, $s2) ➞ "abdehimrstu"
// Contains sorted and distinct letters of the given strings.

$s1 = "abcdefghijklmnopqrstuvwxyz"
$s2 = "abcdefghijklmnopqrstuvwxyz"

longestString($s1, $s2) ➞ "abcdefghijklmnopqrstuvwxyz"
// Contains sorted and distinct letters of the given strings.

Notes

N/A

Watch a quick demo on how Edabit works.