Skip to content

Instantly share code, notes, and snippets.

@navidanindya
Created June 9, 2018 08:55
Show Gist options
  • Save navidanindya/02c2d1c67ff71fd0955c18ebebb7670a to your computer and use it in GitHub Desktop.
Save navidanindya/02c2d1c67ff71fd0955c18ebebb7670a to your computer and use it in GitHub Desktop.
Get unique characters from two strings and return a sorted substring (Python) [ Link: https://repl.it/@nealtheguitaris/SoggyCruelPipeline ]
def longest(s1, s2):
return ''.join(sorted(set(s1 + s2)))
print(longest('aaaabbbdddccc','aadfafiseitaabbbss'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment