这题主要考字符串,难度入门
时间限制 1000ms 内存限制 256MB
描述
输入一行字符(不含空格),将其中的数字字符用*代替。
输入
一行,一串字符(不含空格)。
输出
一行,转换后的字符串。
输入样例 1
woaibiancheng12345
输出样例 1
woaibiancheng*****
提示
输入的字符个数不超过100
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
int i,len;
cin>>s;
len=s.size();//获取长度
for(i=0;i<len;i++){//循环遍历
if(s[i]>='0'&&s[i]<='9'){//如果字符是数字
s[i]='*';//改成0
}
}
cout<<s;
return 0;//好习惯
}