2019-11-14 20:01:51 +00:00
|
|
|
def remove_duplicates(sentence: str) -> str:
|
|
|
|
"""
|
2020-09-24 11:14:52 +00:00
|
|
|
Remove duplicates from sentence
|
2019-11-14 20:01:51 +00:00
|
|
|
>>> remove_duplicates("Python is great and Java is also great")
|
|
|
|
'Java Python also and great is'
|
2020-09-24 11:14:52 +00:00
|
|
|
>>> remove_duplicates("Python is great and Java is also great")
|
|
|
|
'Java Python also and great is'
|
2019-11-14 20:01:51 +00:00
|
|
|
"""
|
2020-09-24 11:14:52 +00:00
|
|
|
return " ".join(sorted(set(sentence.split())))
|
2019-11-14 20:01:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2020-09-24 11:14:52 +00:00
|
|
|
import doctest
|
|
|
|
|
|
|
|
doctest.testmod()
|