Added support for stdin

Note: Ctrl-Z is end of input with eclipse.