In all required positions keep character which occured most times
for i in range ( 2 , n + 1 ) : NEW_LINE INDENT if ( not sieve [ i ] ) : NEW_LINE INDENT ans [ i ] = v [ - 1 ] [ 1 ] ; NEW_LINE DEDENT DEDENT