View Code of Problem 50

#include <string.h>
#include <stdio.h>
main(){
	char str1[100],str2[100],*p = str1,*q = str2;
	int i,n,j = 0;
	gets(p);
	n = strlen(str1);
	for(i=0;i<n;i++){
		if(*(p+i)>=48&&*(p+i)<=57){
			*(q+j) = *(p+i);
			j++;
		}
		else{
			if(*(p+i+1)>=48&&*(p+i+1)<=57 || *(p+i+1) == '\0'){
				*(q+j) = '*';
				j++;
			}
		}
	}
	*(q+j) = '\0';
	puts(q);
	return 0;
}

Double click to view unformatted code.


Back to problem 50