对不对呢?
来源:互联网 发布:bugzilla linux 下载 编辑:程序博客网 时间:2024/04/29 16:04
#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ int t,m=0; cin>>t; char str[400], l[400], c[400]; ; memset(str,'\0',sizeof(str)); cin>>c; if(c[0]=='p') {cout<<'/'<<endl; t=t-1;} while(t--) { int k=0,j=0,i=0,L=0,h; cin>>c; if(c[0]=='p') { continue; } if(c[0]=='c') { cin>>l; h=strlen(l); for(k=0;k<h;k++) { if(l[k]=='.') { m=strlen(str); for(j=m-2;j>=0;j--) { if(str[j]=='/') {L=j;break;} } m=L; k++; } else { str[m++]=l[k]; } } str[m]='/'; m=m+1; str[m]='\0'; } cout<<str<<endl; } return 0; }