solve Problem#14 by BF, good