#include<bits\stdc++.h>
#include<string>
using namespace std;
int br;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	string rec;
	cin >> rec;
	char slovo;
	cin >> slovo;
	for (int i = 0; i < rec.length(); i ++)
	{
		if (rec[i] == slovo)
		{
			br ++;
		}
	}
	rec.erase(remove(rec.begin(), rec.end(), slovo), rec.end());
	cout << br << "\n";
	cout << rec << "\n";
	return 0;
}