(source code: herowanzhu/TypeSolve)