Fixed an index out of range bug of problem 2

Revise the structure of the project