#include "stdio.h" void main(){ int flag = 0; char s1[80]; char s2[80]; int count = 0; gets(s1); for (int i = 0; s1[i] != '\0'; ++i) { if(s1[i] >= '0' && s1[i] <= '9' ){ // s2[count++] = s1[i]; printf("%c",s1[i]); flag = 0; } else{ if(flag == 0){ // s2[count++] = '*'; printf("*"); flag = 1; } } } // puts(s2); } |
Double click to view unformatted code.