#include<stdio.h> #include<string.h> int main(){ char str1[100],str2[100]; gets(str1); int i,j=0; for(i=0;i<strlen(str1);i++){ if(str1[i]>='0'&&str1[i]<='9'){ str2[j++]=str1[i]; } else str2[j++]='*'; } for(i=0;i<strlen(str2);){ if(str2[i]!='*'){ printf("%c",str2[i]); i++; } else if(str2[i]=='*'&&str2[i+1]=='*'){ i++; } else if(str2[i]=='*'&&str2[i+1]!='*'){ printf("*"); i++; } else if(str2[i]=='*'&&str2[i+1]=='\0'){ printf("*"); i++; } } } |
Double click to view unformatted code.