reads multiple lines from stdio and writes to stdout