We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 15baea6 + 5fbaba9 commit 525b0ddCopy full SHA for 525b0dd
python/mostoccuring.py
@@ -0,0 +1,22 @@
1
+# Python program to find the most occurring
2
+# character and its count
3
+from collections import Counter
4
+
5
+def find_most_occ_char(input):
6
7
+ # now create dictionary using counter method
8
+ # which will have strings as key and their
9
+ # frequencies as value
10
+ wc = Counter(input)
11
12
+ # Finding maximum occurrence of a character
13
+ # and get the index of it.
14
+ s = max(wc.values())
15
+ i = wc.values().index(s)
16
17
+ print wc.items()[i]
18
19
+# Driver program
20
+if __name__ == "__main__":
21
+ input = 'geeksforgeeks'
22
+ find_most_occ_char(input)
0 commit comments