solved third problem