Made the sed solution shorter; the output is less nice but it's still within the rules