define is_legal function
Merge branch 'master' of github.com:laozhu/fourdigits