View Code of Problem 50

#include <iostream>
#include <string.h>
using namespace std;

int main(){
    char s[82],s1[81];
    gets(s);
    int len = strlen(s),k=0,flag=0;
    for(int j=0;j<len;j++){
        if(s[j]>='0'&&s[j]<='9'){
            s1[k++] = s[j];
            flag = 0;
        }
        else{
            if(flag == 0){
                s1[k++] = '*';
                flag = 1;
            }
        }
    }
        printf("%s",s1);
}

Double click to view unformatted code.


Back to problem 50