completed assignment #1

tested with input.txt