题解 | #表示数字#
表示数字
https://www.nowcoder.com/practice/637062df51674de8ba464e792d1a0ac6
#include<stdio.h>
int main(void)
{
char str[101]={0};
scanf("%s",&str);
int len=strlen(str);
int i=0;
for(i=0;i<len;i++)
{
if(!(str[i]>='0'&&str[i]<='9'))
{
printf("%c",str[i]);
}
else if(str[i]>='0'&&str[i]<='9')
{
printf("*");
while(str[i]>='0'&&str[i]<='9')
{
printf("%c",str[i]);
i++;
}
printf("*");
i--;
}
}
return 0;
}
int main(void)
{
char str[101]={0};
scanf("%s",&str);
int len=strlen(str);
int i=0;
for(i=0;i<len;i++)
{
if(!(str[i]>='0'&&str[i]<='9'))
{
printf("%c",str[i]);
}
else if(str[i]>='0'&&str[i]<='9')
{
printf("*");
while(str[i]>='0'&&str[i]<='9')
{
printf("%c",str[i]);
i++;
}
printf("*");
i--;
}
}
return 0;
}