Hi John,
3 suggestions to make it easier to help you.
- read input from stdin. You can put the data in a file, but redirect stdin to read from that file somewhere in your settings.
- write output to stdout. You can redirect stdout to a file if you wish (somewhere in your settings).
- handle input in the format stated in the problem description