View Code of Problem 50

#include<stdio.h>
#include<string.h>
int main(){
	char str1[80],str2[80];
	int count=0;
	gets(str1);
	int l=strlen(str1);
	for(int i=0;i<l;i++){
		if((str1[i]<='9')&&(str1[i]>='0')){
			str2[count]=str1[i];
			count++;
		}
		else{
			str2[count]='*';
			count++;
		}
	}
	for(int j=0;j<count;j++){
		if((str2[j]==str2[j+1])&&(str2[j]=='*')){
		  for(int k=j;k<count;k++){	
				str2[k]=str2[k+1];
			}
		  j--;
		  count--;
		}
	}
	for(int z=0;z<count;z++){
		printf("%c",str2[z]);
	}
	printf("\n");
}

Double click to view unformatted code.


Back to problem 50