Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- #include<stdio.h>
- using namespace std;
- int main ()
- {
- int t;
- scanf("%d",&t);
- int c=0;
- char str1[100][100];
- char str[100];
- for ( int i=1; i<=t; i++)
- {
- int c=0;
- strcpy(str1[++c],"http://www.lightoj.com/");
- printf("Case : %d\n",i);
- while(1)
- {
- scanf("%s",str);
- if (!strcmp(str,"QUIT"))
- {
- break;
- }
- if(!strcmp(str,"VISIT"))
- {
- scanf("%s",str1[++c]);
- printf("%s\n",str1[c]);
- // printf("%d\n",c);
- }
- if (!strcmp(str,"BACK"))
- {
- --c;
- if (c<=0)
- {
- printf("Ignored\n");
- }
- else
- printf("%s\n",str1[c]);
- }
- if (!strcmp(str,"FORWARD"))
- {
- ++c;
- if (c==1)
- {
- c=2;
- }
- // printf("%d\n",c);
- if (str1[c][0]=='\0')
- {
- printf("Ignored\n");
- }
- else
- {
- printf("%s\n",str1[c]);
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement