Loop to count the occurrence of ith character before jth character in the given String
for i in range ( n ) : NEW_LINE INDENT c = ( ord ( s [ i ] ) - ord ( ' a ' ) ) NEW_LINE for j in range ( 26 ) : NEW_LINE INDENT dp [ j ] += freq [ j ] NEW_LINE DEDENT DEDENT