View Code of Problem 50

#include<stdio.h>
#include<string.h>

int main(){
	int i,count=0,j=0,w;
	char str1[90],str2[90];
	scanf("%s",str1);

	for(i=0;i<strlen(str1);i++){
		if('0'<=str1[i]&&str1[i]<='9'){
			str2[i]=str1[i];
		}else{
			str2[i]='*';
		}

	}
	for(i=0;i<strlen(str1);i++){
		if(str2[i]=='*'&&w==0)
		{
			printf("%c",str2[i]);
			w=1;
		}
		if(str2[i]=='*'&&w==1){
			continue;
		}
		if(str2[i]>='0'&&str2[i]<='9'){
			printf("%c",str2[i]);
			w=0;
		}
	}
	printf("\n");
	return 0;
}

Double click to view unformatted code.


Back to problem 50