【leetcode】整理字符串

 

char * makeGood(char * s){
    int pst=0,i,len=strlen(s);
    for (i=1; i<len; i++)
    {
        if (pst>=0 && abs(s[pst]-s[i]) == 32) pst--;
        else s[++pst] = s[i];
    }
    s[pst+1] = '\0';
    return s;
}