#include <iostream>
#include <string>
using namespace std;
int main()
{
int i, j, s, t;
string S, T;
cin >> S >> T;
s = S.size();
t = T.size();
int Ss[s]={0}, Tt[t]={0}, n[t];
for (i=0;i<s;i++)
Ss[i] = S[i] - 'a';
for (i=0;i<t;i++)
Tt[i] = T[i] - 'a';
for (i=0;i<t;i++)
n[i] = -1;
for (i=0;i<t;i++)
for (j=0;j<s;j++)
if (Tt[i] == Ss[j]) {
n[i] = j;
Ss[j] = -1;
break;
}
for (i=0;i<t;i++) {
if (n[i] != -1)
cout << n[i] + 1 << " ";
else
cout << "X ";
}
}