We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f815175 commit 2cfccd1Copy full SHA for 2cfccd1
1 file changed
data_structures/strings/unique_char_check.py
@@ -0,0 +1,24 @@
1
+"""
2
+Question
3
+You are given a string S, check if all characters are unique.
4
+
5
+SAMPLE INPUT 1
6
+abcd
7
+SAMPLE OUTPUT 1
8
+True
9
10
+SAMPLE INPUT 2
11
+aabc
12
+SAMPLE OUTPUT 2
13
+False
14
15
+from collections import Counter
16
+def unique_char_check(S):
17
+ character_count = Counter(S)
18
19
+ if len(character_count) == len(S):
20
+ return True
21
+ return False
22
23
+S = input()
24
+print(unique_char_check(S))
0 commit comments