We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b39e8ba + 25fed74 commit 5e34b70Copy full SHA for 5e34b70
1 file changed
removeduplicates.py
@@ -0,0 +1,28 @@
1
+# https://www.facebook.com/hitesh.parashar.908/posts/109797064227048
2
+# subscribed by hitesh parashar
3
+
4
5
+from collections import Counter
6
7
+def remov_duplicates(input):
8
9
+ # split input string separated by space
10
+ input = input.split(" ")
11
12
+ # joins two adjacent elements in iterable way
13
+ for i in range(0, len(input)):
14
+ input[i] = "".join(input[i])
15
16
+ # now create dictionary using counter method
17
+ # which will have strings as key and their
18
+ # frequencies as value
19
+ UniqW = Counter(input)
20
21
22
+ s = " ".join(UniqW.keys())
23
+ print (s)
24
25
+# Driver program
26
+if __name__ == "__main__":
27
+ input = 'Python is great and Java is also great'
28
+ remov_duplicates(input)
0 commit comments