View Code of Problem 50

#include<iostream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cmath>
using namespace std;
#pragma warning(disable:4996)


int main() {
	char s[100];
	gets(s);
	int n = strlen(s);
	int fg = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] >= '0'&&s[i] <= '9') {
			printf("%c", s[i]);
			fg = 0;
		}
		else {
			if (fg == 0) {
				printf("*");
				fg = 1;
			}
		}
	}
	return 0;
}	

Double click to view unformatted code.


Back to problem 50