Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- string bro[1000];
- int main()
- {
- int n,t,i,j,k;
- string s,c;
- cin>>t;
- for(i=1;i<=t;i++)
- {
- cout<<"Case "<<i<<":"<<endl;
- j=0,k=0;
- bro[j]="http://www.lightoj.com/";
- while(1){
- cin>>c;
- if(c=="QUIT")
- break;
- else if(c=="VISIT")
- {
- cin>>s;
- cout<<s<<endl;
- bro[++k]=c;
- j=k;
- }
- else if(c=="BACK")
- {
- if(k-1<0)
- cout<<"Ignored"<<endl;
- else
- cout<<bro[--k]<<endl;
- }
- else if(c=="FORWARD")
- {
- if(k+1>j)
- cout<<"Ignored"<<endl;
- else
- cout<<bro[++k]<<endl;
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment