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