ADD: java code to read input from stdin