solve 18th problem