#include<bits/stdc++.h>
using namespace std;
int main(){
string s,t;
bool check;
while(cin>>s>>t){
for(int i=0;i<t.size();i++){
check=1;
for(int j=0;j<s.size();j++){
if(t[i]==s[j]){
cout<<j+1<<" ";
s[j]=' ';
check=0;
break;
}
}
if(check){
cout<<"X ";
}
}
cout<<'\n';
}
}