Delete duplicated part of the original symbol after expanded candidate

Delete the remaining part of the original symbol after expanded a candidate if
the remaining part of the original symbol is the end part of the expanded
candidate. For example, if the buffer is "some|thing" where '|' is the cursor
position, if "something" is also a candidate and is being expanded, the result
will be "something|" rather than "something|thing". Note that if the buffer is
"|something" and we expanded the candidate "otherthing", the result will be
"otherthing|something" rather than "otherthing|" because in this case I believe
"otherthing" should NOT be replaced by the expanded candidate. Always replacing
the existing symbol with the expanded candidate is not good because in case that
you don't want "something" to be replaced by "otherthing" you will have to move
the cursor one position back first and enter a space, but if "something" is
already at the beginning of the line then you will have to enter a space first
and then press the LEFT arrow to get back which is painful if you use vi key
binding within emacs like myself. Even if you are not using vi key binding, this
is also a very unnatural way of editing.
Temporarily bind `print-length' to nil before `pp'

This is needed to prevent `pp' from abbreviating the output while printing the
completion history.