slightly improved implementation of TerminalInputStream, added String.charAt