Merge Unique Letters

Write a function longest that takes strings s1 and s2, collects all characters that appear in at least one of them, removes duplicates, and sorts the result in ascending order. Return the result as one string. One of the original strings may be empty.

Примеры

Ввод
"aretheyhere", "yeartroptpar"
Вывод
"aehoprty"
Ввод
"loopingisfunbutdangerous", "lessdangerousthancoding"
Вывод
"abcdefghilnoprstu"
Ввод
"inmar", "gbea"
Вывод
"abegimnr"

Нужно реализовать

def longest(s1: str, s2: str) -> str:

Теги

stringssetsorting
PostgreSQLv16

Čia bus kodo vykdymo rezultatas

Tests12
Visible tests
Paslėptas testas 7
Paslėptas testas 8
Paslėptas testas 9
Paslėptas testas 10
Paslėptas testas 11
Paslėptas testas 12

They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.

Focus radio
Paused · SomaFM · Fluid