View Code of Problem 50

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>

char a[100];

int main()
{
    int n;
    while (gets(a)) {
        int len = strlen(a);
        int hello = 1;
        for (int i = 0; i < len; i++) {
            if(a[i] >= '0' && a[i] <= '9')
            {
                putchar(a[i]);
                hello = 1;
            }
            else {
                if (hello == 1) {
                    hello = 0;
                    putchar('*');
                }
            }
        }
        putchar('\n');
    }
}

Double click to view unformatted code.


Back to problem 50