Use library readline to handle input

Library readline provides several functions that make typing words
easier. Besides basic shortcut keys for editing words, this commit also
utilizes the history feature.