DP algorithm is abondoned. Still time limit exceeded.

dictionary for test is generated by command 'tail -10000
/usr/share/dict/words'