View Code of Problem 50

#include<iostream>
#include<cmath>
#include<cstdio>
#include <cstring>
using namespace std;

int main() {
	char s1[100], s2[100];
	gets(s1);
	int n;
	n = strlen(s1);
	for (int i = 0; i < n; i++) {
		if (s1[i] <= '9' && s1[i] >= '0') {
			putchar(s1[i]);
		}
		else {
			if (i == 0)
				putchar('*');
			else {
				if (s1[i - 1] <= '9' && s1[i - 1] >= '0') {
					putchar('*');
				}
			}
		}
	
	}
	return 0;

}	

Double click to view unformatted code.


Back to problem 50