#include<stdio.h> #include<math.h> #include<string.h> #define max 80 int main() { char str[max]; char str1[max]; gets(str); int j=0; int d=strlen(str); for(int i=0;i<d;i++){ if(str[i]>='0'&&str[i]<='9'){ str1[j]=str[i]; j++; } else if(str1[j-1]!='*'){ str1[j]='*'; j++; } } puts(str1); return 0; } |
Double click to view unformatted code.