View Code of Problem 50

#include<stdio.h>
#include<string.h>
 
 
int main() {
	
	char s[81];
	gets(s);
	int j = 0;
	for (int i = 0;s[i] != '\0';i++) {
		if (s[i] >= '0'&&s[i] <= '9') {
			s[j++] = s[i];
		}
		else {
			if (j == 0) {
				s[j++] = '*';
			}
			else {
				if (s[j - 1] == '*') {
					continue;
				}
				else {
					s[j++] = '*';
				}
			}
		}
	}
	s[j] = '\0';
	printf("%s\n", s);	
	return 0;
 
}

Double click to view unformatted code.


Back to problem 50