solve Problem#11 by BF, debug version