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