added output for the three possible options
changed input and output to prevent the file from being overwritten before it is read