Given a string, write a python program to find the most occurrence character and its number of occurrences.
Input : hello Output : ('l', 2) Input : geeksforgeeks Output : ('e', 4)
We can solve this problem quickly in python using Counter() method. Simple Approach is to
1) Create a dictionary using Counter method having strings as keys and their frequencies as values.
2) Find the maximum occurrence of a character i.e. value and get the index of it.
- Python Program to Find the Number Occurring Odd Number of Times
- Python program to find occurrence to each character in given string
- Python | Count K character between consecutive characters
- Python program for removing i-th character from a string
- Python Regex | Program to accept string ending with alphanumeric character
- Python | Find position of a character in given string
- Python | Find frequency of given character at every position in list of lists
- Python - Maximum occurring Substring from list
- Python - Remove all duplicate occurring tuple records
- Python | Insert character after every character pair
- Python Program for Program to find area of a circle
- Python Program for Check if count of divisors is even or odd
- Python Program to Count set bits in an integer
- Python program to count words in a sentence
- Python program to count Even and Odd numbers in a List
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.