注意strlen()的复杂度,不要在循环中使用
for(int i=0;i<strlen(tmp);i++)
这类代码,strlen()的复杂度是O(n)的。 你应该以下这样或者使用string
int len=strlen(tmp); for(int i=0;i<len;i++)