solved 78 with the same logic as 76