题解 | #表示数字#
表示数字
https://www.nowcoder.com/practice/637062df51674de8ba464e792d1a0ac6
#include <stdio.h> #include <string.h> int isnum(char *ch) { if(*ch>='0'&&*ch<='9') { return 1; } return 2; } int main() { int flag; char str[102]; char p=str; scanf("%s",str); if(isnum(str)==1) printf(""); for(p=str;p<str+strlen(str);p++) { flag=isnum(p); if(flag==2) { printf("%c",p); if(isnum(p+1)==1) printf("");
} if(flag==1) { printf("%c",*p); if(isnum(p+1)==2) printf("*"); } } return 0;
}