Modify script to read input from STDIN and print results.