longest common prefix Python AC, CPP runtime error

Damn CPP… The algorithm should be right, and it was compiled OK in my
machine. Don’t know why couldn’t passed by OJ.