View Code of Problem 50

#include<stdio.h>
int isNum(char* c) {
	return  '0' <= *c && *c <= '9';
}
int main() {
	char str1[81];
	char str2[82];
	char* cur1 = str1, *cur2 = str2;
	*cur2 = '\0';
	scanf("%s", str1);
	while (*cur1 != '\0') {
		if (isNum(cur1)) {
			cur2++;
			*cur2 = *cur1;
		}
		else if (*cur2 != '*') {
			cur2++;
			*cur2 = '*';
		}
		cur1++;
	}
	cur2++;
	*cur2 = '\0';
	printf("%s", str2 + 1);
	return 0;
}

Double click to view unformatted code.


Back to problem 50