#include<iostream> #include<stack> #include<stdlib.h> using namespace std; stack<char> s;//当前搜索路径的LCS stack<char> lcs[100];//所有的LCS int count=0;//记录LCS的数量 bool lcs_have_exist(stack<char> lcs[],int count,stack<char> s) {//判断当前搜索的LCS是否已存在于 stack_lcs[MAX] int i; bool exist=false; for (i=0;i<count;i++) { if(lcs[i]==s) { exist=true; break; } } return exist; } void clear_stack(stack<char> &s) { while(!s.empty()) { s.pop(); } } void out_stack()//输出栈s内容 { stack<char> copy=s; cout<<count+1<<":"; while(!copy.empty()) { cout<<copy.top()<<" "; copy.pop(); } } void ALL_LCS(char X[],int b[][100],int i,int j) { if(i==0||j==0)//当前搜索路径走到尽头 { if(!lcs_have_exist(lcs,count,s))//若当前搜索的LCS是新