`
int tans(char *S) { int sum = 0; int i = 0; while (isdigit(S[i])) { sum = sum * 10 + (S[i++] - '0'); } return sum; }