View Code of Problem 50

#include <stdio.h>
#include <string.h> 
int main(){
	char str1[10000],str2[10000];
	int i,len,j=0;
	scanf("%s",str1);
	len=strlen(str1);
	for(i=0;i<len;i++){
		if(str1[i]>='0' && str1[i]<='9') {
		str2[j++]=str1[i];
		}
		else{
			if(str1[i+1]>='0'&&str1[i+1]<='9'&&i<len){
				str2[j++]='*';
			}
			if(i==len-1){
				str2[j++]='*';
			}
		}
	}
	int len2=strlen(str2);
	for(i=0;i<len2;i++){
			printf("%c",str2[i]);
	} 
	return 0;
}

Double click to view unformatted code.


Back to problem 50