solution for bob exercise