Fix getline

getline did swallow a character during each scanf step and did not
work with empty input.
Add assignments 2 and 3 of exercise 7