ACBFGED ABCDEFG CDAB CBAD
#include<iostream> #include<memory.h> #include<deque> #include<stdio.h> #include<map> using namespace std; void getlen(char *a,char *b,char *c,int len) { if(len<=0) return; int j=0; while(b[j]!=a[len-1]) { j++; } getlen(a,b,c+1,j); getlen(a+j,b+j+1,c+j+1,len-j-1); c[0]=a[len-1]; } int main() { char a[27]; char b[27]; while(!cin.eof()) { char c[27]; cin>>a; cin>>b; int len=strlen(a); c[len]=‘\0‘; // cout<<a[len]<<endl; getlen(a,b,c,len); cout<<c<<endl; } return 0; }
nyoj重建二叉树(不真的建立),布布扣,bubuko.com
原文:http://www.cnblogs.com/hansongjiang/p/3709105.html