Solution for Decode Ways, reference from mitbbs peking2's solution