solved 26
solved 39 using same logic as 9