I need an idea how to do this?

I need an idea how to do this?

I have five names i.e strings apple,boy,cup,dog,egg in db or in array (mysql) 
I have textbox when I enter any of these five words it should print down to the textbox(not using autocomplete)
and left over should display remaining left u haven't typed?
How to do it?
KRISHGANI2@GMAIL.COM