How are the results wrong?
What results did you get, and what results did you expect?
Is a requirement that T,O,G,D are all unique? If so, then you haven't coded this into your program.
Is a requirement that neither of TOO and GOOD begin with zero? Similarly you haven't coded that in.