题解 | #表示数字#
表示数字
http://www.nowcoder.com/practice/637062df51674de8ba464e792d1a0ac6
#include <stdio.h>
int shuzi(char c){
if((c>='0')&&(c<='9')) return 1;
return 0;
}
int main(){
char str[1000];
int len,i,shuf;
while(scanf("%s",str)!=-1){
len=strlen(str);
shuf=0;
if(shuzi(str[0])){
printf("*");
shuf=1;
}
for (i=0;i<len;i++){
if(shuf){
if(shuzi(str[i])){}
else {
printf("*");
shuf=0;
}
}
else{
if(shuzi(str[i])){
printf("*");
shuf=1;
}
}
printf("%c",str[i]);
}
if(shuzi(str[len-1])) printf("*");
printf("\n");
}
return 0;
}