003400360030003600361585481474240
身份证号掩盖出生日期
身份证号掩盖出生日期
描述
输入一个18位身份证号,用8个‘*‘替换其中代表出生年月的字符后输出
如果输入不是18位,输出’error‘
s=input()
#include <stdio.h>
#include <string.h>
int main()
{
char ch[100];
scanf("%s", &ch[0]);
if (strlen(ch) != 18)
{
printf("error");
}
else
{
for(int i = 6; i < 14; i++)
ch[i] = '*';
printf("%s", ch);
}
return 0;
}
s=input() #这是python的写法
if len(s) != 18:
print("error")
else:
s = s[0:6] + "********" + s[14:18]
print(s)