Optimize StringScanner

* Avoid substring on main buffer
* Lookup in WordList using Set instead of List
* Avoid over Object Creation in TerminalEncoder