calculate sum after fixing a particular char
xsum = fact [ length - 1 - k ] NEW_LINE for j in range ( 0 , MAX_CHAR ) : NEW_LINE INDENT xsum = xsum // fact [ freq [ j ] ] NEW_LINE DEDENT Sum += xsum NEW_LINE