Changed way to read input from console. This make hack function more simply.