View Code of Problem 50

#include<stdio.h>
#include<string.h>
int main(){
char str_1[80];
char str_2[80];
int flag=1,j=0;
gets(str_1);
for(int i=0;i<strlen(str_1);i++){
    if(str_1[i]>='0'&&str_1[i]<='9'){
        str_2[j]=str_1[i];
        flag=1;
        j++;
    }
    else{
        if(flag==1){
            str_2[j]='*';
            j++;
            flag=0;
        }
    }
}
for(int i=0;i<strlen(str_2);i++)
printf("%c",str_2[i]);
}

Double click to view unformatted code.


Back to problem 50