Design and implementation of input auto-completion function