Skip to content

Commit b1b27f0

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 76851cf commit b1b27f0

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

strings/remove_duplicate.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
def remove_duplicates(sentence: str) -> str:
22
"""
33
Remove duplicates from sentence and return words in sorted order
4-
4+
55
Args:
66
sentence: Input string containing words separated by spaces
7-
7+
88
Returns:
99
String with unique words sorted alphabetically
10-
10+
1111
Examples:
1212
Basic functionality:
1313
>>> remove_duplicates("Python is great and Java is also great")
1414
'Java Python also and great is'
15-
15+
1616
Multiple spaces handling:
1717
>>> remove_duplicates("Python is great and Java is also great")
1818
'Java Python also and great is'
19-
19+
2020
Edge cases:
2121
>>> remove_duplicates("")
2222
''
23-
23+
2424
>>> remove_duplicates(" ")
2525
''
26-
26+
2727
>>> remove_duplicates("hello")
2828
'hello'
29-
29+
3030
>>> remove_duplicates("hello hello hello")
3131
'hello'
32-
32+
3333
Mixed case (case sensitive):
3434
>>> remove_duplicates("Python python PYTHON")
3535
'PYTHON Python python'
36-
36+
3737
Numbers and special characters:
3838
>>> remove_duplicates("1 2 3 1 2 3")
3939
'1 2 3'
40-
40+
4141
>>> remove_duplicates("hello world hello world!")
4242
'hello world world!'
43-
43+
4444
Single character words:
4545
>>> remove_duplicates("a b c a b c")
4646
'a b c'
47-
47+
4848
Mixed content:
4949
>>> remove_duplicates("The quick brown fox jumps over the lazy dog")
5050
'The brown dog fox jumps lazy over quick the'
@@ -55,4 +55,4 @@ def remove_duplicates(sentence: str) -> str:
5555
if __name__ == "__main__":
5656
import doctest
5757

58-
doctest.testmod()
58+
doctest.testmod()

0 commit comments

Comments
 (0)