Maintain the frequency
for i in range ( len ( s ) ) : NEW_LINE INDENT freq [ ord ( s [ i ] ) - ord ( ' A ' ) ] += 1 NEW_LINE DEDENT countNumberOfStringsUtil ( freq , count ) ; NEW_LINE return count NEW_LINE