removed unnecessary things, passed test 3
passed test 4
passed test 5
Switched to python 3.4, passed test 6
fixed the trailing '\n' on rows with the 'g' command, passed test 7
optimize