solved exercise 10 from text-files