Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

count repeated strings map python

# Python 3+
import collections
collections.Counter(input_string) # The almost fastest
# Python 2
{key: string.count(key) for key in set(string)} # The second fastest
Source by colab.research.google.com #
 
PREVIOUS NEXT
Tagged: #count #repeated #strings #map #python
ADD COMMENT
Topic
Name
1+4 =