#include<stdio.h>
#include<stdio.h>
#include<string.h>
char a[28];
char b[28];
int count;
int all;
int step;
void search(int m, int n){
int i;
if(count == all){
return ;
}
for(i = m; i < n; i++){
if(b[i] == a[step]){
count++;
step++;
break;
}
}
if(i == n){
return ;
}
search(m, i); //左子树
search(i + 1, n); //右子树
printf("%c", b[i]);
}
int main()
{
int j;
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
while(scanf("%s %s", a, b) != EOF){
getchar();
step = 0;
count = 0;
j = strlen(a);
all = j;
search(0, all);
printf("\n");
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
}
return 0;
}
#include<stdio.h>
#include<string.h>
char a[28];
char b[28];
int count;
int all;
int step;
void search(int m, int n){
int i;
if(count == all){
return ;
}
for(i = m; i < n; i++){
if(b[i] == a[step]){
count++;
step++;
break;
}
}
if(i == n){
return ;
}
search(m, i); //左子树
search(i + 1, n); //右子树
printf("%c", b[i]);
}
int main()
{
int j;
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
while(scanf("%s %s", a, b) != EOF){
getchar();
step = 0;
count = 0;
j = strlen(a);
all = j;
search(0, all);
printf("\n");
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
}
return 0;
}