2890: C--去掉+86
2890: C--去掉+86
Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 210 Solved: 91
[Submit][Status][Web Board]
Description
小明突然发现自己手机上的部分手机号前面多了+86,如+8618253556785。为了使用方便,小明想将这些多余的前缀去掉,请你帮小明编写程序去掉这些多余的前缀。
Input
长度为14或11的字符串,只包含‘+’、0~9字符,
有多个字符串,每个一行。
Output
去掉+86格式统一的手机号,每个手机号占一行。
Sample Input
+8618253591234
18253593244
+8618345456743
Sample Output
18253591234
18253593244
18345456743
HINT
#include<stdio.h>
#include<string.h>
int main()
{
char a[100];
int len,i;
while(scanf("%s",a)!=EOF)
{
len=strlen(a);
if(a[0]=='+')
{
for(i=3;i<len;i++)
a[i-3]=a[i];
a[len-3]='\0';
}
printf("%s\n",a);
}
return 0;
}

浙公网安备 33010602011771号