#include<bits/stdc++.h>
#include<cmath>

using namespace std;

int main(){

string T, S;
int M, N, i, L[1000], mini,m;

cout<<"Unesi T pa S: \n";
cin>>T>>S;
M = S.size();
N = T.size();

mini = 100;
for(i = 0; i<N; i++){
    L[i] = count(T.begin(), T.end(), T[i]);
mini = min(mini, L[i]);
}

for(i = 0; i<N; i++){
   if(mini == count(T.begin(), T.end(), T[i])) {
    break;
   }

}
if(mini>=2){
        for(m = i; m<mini; m++){
    T[m] = '*';
        }
}
T[i] = '*';

cout<<count(T.begin(),T.end(),'*')<<"\n";
cout<<T;




return 0;
}