View Code of Problem 50

int main(){
	char str1[80];
	char str2[80];
	int i,n,j=0;
	gets(str1);
	n=strlen(str1);
	for(i=0;i<n;i++){
		if(str1[i]>='0'&&str1[i]<='9'){
			str2[j]=str1[i];
			putchar(str2[j]);
			j++; 
		}
		else if(str2[j-1]!='*'){
			str2[j]='*';
			putchar(str2[j]);
			j++;
		}	
	}
}

Double click to view unformatted code.


Back to problem 50