#include <vector>
#include <string>
#include <iostream>
using namespace std;
const int MAX = 100100;
int P[26];
int S[26];
int D[MAX];
int main(int argc, char* argv[])
{
string a, b;
cin>>a>>b;
for (int i = 0; i < a.size(); i++)
{
P[a[i] - 'a'] = i;
}
vector<int> res;
for (int i = 0; i < b.size(); i++)
{
int c = b[i] - 'a';
int ind = P[c];
int out = ind - S[c];
res.push_back(out);
for (int j = 0; j < 26; j++)
{
if (P[j] > ind) S[j]++;
}
P[c]--;
D[ind] = 1;
while(P[c] > 0 && a[P[c]] != b[i])
{
if (D[P[c]]) S[c]--;
P[c]--;
}
}
printf("%d\n", res.size());
for (int i = 0; i < res.size(); i++)
{
printf("%d ", res[i] + 1);
}
printf("\n");
}