solve exercise #18