#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char s[256],c, v[2]=" ",*p ;
cin>>c;
cin.get();
cin.get(s,256);
int ct=0;
p=strtok(s,v);
while(p!=NULL)
{
if(strchr(p,c))
{
ct++;
cout<<p<<" ";
}
p=strtok(NULL,v);
}
cout<<"\n"<<ct;
return 0;
}