We form a substring from that maximum character index till end and check if its greater that maxstring
for i in range ( len ( index ) ) : NEW_LINE INDENT if ( st [ index [ i ] : len ( st ) ] > maxstring ) : NEW_LINE INDENT maxstring = st [ index [ i ] : len ( st ) ] NEW_LINE DEDENT DEDENT return maxstring NEW_LINE