View Code of Problem 50

#include <stdio.h>
#include <string.h>


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

Double click to view unformatted code.


Back to problem 50