Yet another CS homework