Solves second task in TextFiles