1 solutions
-
0
C :
#include<stdio.h> #include<string.h> int main() { int i,d; char str[10000]; while(scanf("%s",str)!=EOF) { d=0; for(i=0;str[i]!='\0';i++) { if(!d) { if(str[i]=='/'&&str[i-1]=='/') d=1; } else {if(str[i]==':'||str[i]=='/') break; printf("%c",str[i]); } } printf("\n"); } return 0; }C++ :
#include<iostream> #include<string> using namespace std; int main() { string str; while(cin>>str) { int pos1=str.find("//"); int pos2=str.find(':',pos1+2); if(pos2==string::npos) pos2=str.find('/',pos1+2); cout<<str.substr(pos1+2,pos2-pos1-2)<<endl; } return 0; }
- 1
Information
- ID
- 19635
- Time
- 1000ms
- Memory
- 32MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By