Hdu 4018 正则表达式(简单)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| #include <cstdio> #include <cstdlib> #include <cstring>
int main(){ //freopen("in.txt","r",stdin); char str[100]; char ch[100]; int n;
scanf("%d",&n); for(int j = 1;j <= n;j++){ scanf("%s",str); for(int i = 0;str[i+2] != '\0';i++){ if(str[i] == '/'){ if(str[i+1] == '/'){ strcpy(ch,&str[i+2]); break; }
} } for(int i = 0;ch[i] != '\0';i++){ if(ch[i] == '/' || ch[i] == ':'){ ch[i] = '\0'; break; } } printf("Case #%d: %s\n",j,ch); } return 0; }
|
最后更新时间:
欢迎评论~