View Code of Problem 50

#include<bits/stdc++.h>
using namespace std;

int main(){
    char str1[99];
    char str2[99];
    gets(str1);
    int i,j=0;
    for(i=0;str1[i];i++){
        if(isdigit(str1[i])){
          str2[j]=str1[i];j++;
        }
        else {
            while(str1[i+1]!='\0'&&!isdigit(str1[i+1])){
                  i++;
                  }
                  str2[j]='*';j++;
        }
    }
    str2[j]='\0';
    puts(str2);
	return 0;
}



Double click to view unformatted code.


Back to problem 50