text: Maximum occurrence of prefix in the Array | Function to return the count of the required prefix ; Find the frequency of first character of str1ing ; Driver code
code: def prefixOccurrences ( str1 ) : NEW_LINE INDENT c = str1 [ 0 ] NEW_LINE countc = 0 NEW_LINE for i in range ( len ( str1 ) ) : NEW_LINE INDENT if ( str1 [ i ] == c ) : NEW_LINE INDENT countc += 1 NEW_LINE DEDENT DEDENT return countc NEW_LINE DEDENT str1 = " abbcdabbcd " NEW_LINE print ( prefixOccurrences ( str1 ) ) NEW_LINE